Main Content

mlreportgen.dom.getDefaultNumberFormat

Get default formatting for DOM API numeric data

Since R2021a

Description

formatSpec = mlreportgen.dom.getDefaultNumberFormat returns the default number format specification as a character vector. To set the default number format specification, use mlreportgen.dom.setDefaultNumberFormat.

example

Examples

collapse all

Get the current default number format that the DOM API uses when representing a number as text.

import mlreportgen.dom.*

rpt = Document("myReport","pdf");

numberFormat = getDefaultNumberFormat();
p = Paragraph("Default number format is : ");
p.append(numberFormat);

append(rpt,p);

close(rpt);
rptview(rpt);

Output Arguments

collapse all

Format specification, returned as a character vector. The specification is a valid format specification for the sprintf function and uses one of these operators:

  • %f

  • %e

  • %E

  • %g

  • %G

If the format specification is an empty character vector, the DOM API formats numbers using the maximum number of digits needed to represent the number accurately. For more information about how the DOM API chooses a format specification, see mlreportgen.dom.Number.

Version History

Introduced in R2021a