x = [4/3 1.2345e-6]
x =
1.3333 0.0000
Set the format to 5-digit floating point:
format short e
x
x =
1.3333e+00 1.2345e-06
Set the format to 15-digit scaled fixed point:
format long
x
x =
1.333333333333333 0.000001234500000
Set the format to 'rational' for small integer ratio output:
format rational
x
x =
4/3 1/810045
Set an integer value for x and display it in hexadecimal (base 16) format:
format hex
x = uint32(876543210)
x =
343efcea
Setting Numeric Format in a Program
To temporarily change the numeric format inside a program, get the original format using
the get function and save it in a variable. When you finish working with the new format,
you can restore the original format setting using the set function as shown here:
origFormat = get(0, 'format');
format('rational');
-- Work in rational format --
set(0,'format', origFormat);
Display Format for Numeric Values