Question

How to print in Matlab Like following....

0.01000E+02

I have tried

sprintf('%12.5e',[0.01000E+02])

it is giving me

1.00000e+000
Was it helpful?

Solution

You format is a bit specific. You should consider writing your own output function.

But a few pointers:

  • Make e large with upper
  • only 2 digits in exp number through a regexp. new_string = regexprep(old_string,'\d(\d{2})$','\1')
  • the thing with leading 0 in exp representation is not standard - so maybe multiply with 1e2, print the float and later attach the E+02.

OTHER TIPS

Something like ['0.0' strrep(sprintf('%12.5E',v*100), '.', '')] (with v your value) should work if I understand correctly your format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top