I am trying to print a long table of numbers in octave terminal.
disp(vec);
What I get
7.0931e-01
6.2041e-05
9.7740e-01
9.9989e-01
8.8428e-01
9.0524e-01
...
Such numerical notation is a pain to read. How can I set octave terminal to output numbers normally as 0.7, 0.014, 0.95
?
You can use format short g
to display each number is a more logical format
format short g
disp(vec)
% 0.70931
% 6.2041e-05
% 0.9774
% 0.99989
% 0.88428
% 0.90524
Using 'fprintf' could help in such cases
a=0.0001234;
fprintf('%.3f\n',a)
But here the limitation is that number of decimal points would be fixed so in some numbers it will display zeros at the end while for some numbers it might cut off the number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With