MATLAB: Format short, format long, format short E, format long E, format rat

formatMATLABrepresentation formats

How can i represent a number let's say 1231312.1232323 with the formats long/short/long e /short e /rat more elegant or in a single code line without having to write 10 colums i was thinking of the fprintf and format spec commands . P.S i'm very much a beginner in matlab 🙂 .

Best Answer

For a single value I would suggest the fprintf function:
v=1234567.1234567;
fprintf('%.7f\n',v)
1234567.1234567
Related Question