I'm writing data to an output text file using the fprintf
command in Matlab. How to write a number to the output file, for instance, 1.12345678e-001
, with three digits in the exponent?
formatSpec = '%1.8e\n';
gives 1.12345678e-01
, not the desired result!
There's a similar question here https://se.mathworks.com/matlabcentral/answers/100772-how-do-i-use-fprintf-to-write-numbers-in-exponential-notation-of-variable-exponent-digits-on-a-windo
But following the instructions given there didn't solve the problem!