Format of the output fields, specified using formatting
operators. formatSpec also can include ordinary
text and special characters.
formatSpec can be a character vector in
single quotes, or, starting in R2016b, a string scalar.
Formatting Operator
A formatting operator starts with a percent
sign, %, and ends with a
conversion character. The conversion character is required.
Optionally, you can specify identifier, flags, field width,
precision, and subtype operators
between % and the conversion character. (Spaces
are invalid between operators and are shown here only for
readability).
Conversion Character
This table shows conversion characters to format numeric and
character data as text.
Value Type
Conversion
Details
Integer, signed
%d or %i
Base 10
Integer, unsigned
%u
Base 10
%o
Base 8 (octal)
%x
Base 16 (hexadecimal), lowercase
letters a–f
%X
Same as %x, uppercase
letters A–F
Floating-point number
%f
Fixed-point notation (Use a precision operator to specify the
number of digits after the decimal point.)
%e