file io - Leading zero in Matlab's scientific notation -
in matlab, when printing using e
such fprintf('%10.5e\n', pi/100)
1 result 3.14159e-02
. however, if want number have leading 0 such 0.314159e-1
? how can manage matlab?
the reason ask trying print file need have leading zeros. otherwise, not care.
thanks.
i don't think there clever way it:
your_number = pi; ['0.' strrep(sprintf('%10.5e',your_number*10), '.', '')] >> ans = 0.314159e+01
Comments
Post a Comment