Is there a way to set the output format in Octave to a given number of significant digits?

Viewed 660

In Octave, format short g sets the numeric output format in the command window to 5 significant digits, and format long g to 15 digits. Is there a way to set it to a different number of digits different from 5 or 15? I know how to use num2str, mat2str... but I prefer it to be a default output format.

I don't think it is possible, but I am asking just in case (it would be quite useful for my use case).

1 Answers

I think you need the output_precision function. For example, if you want to have 7 digits in the command window, type this:

output_precision(7)
Related