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
有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top