This is helpful removing the leading zero. Is there a way to maintain the exponential format? I think i can take care of the E+000 to E+00 issue by simply using some string modification functions.
No, according tothe documentation '%s' means 'string', not 'scientific'. I assume you mean '%e' for the scientific notation.
But to my surprise the output is exactly the same (tested under 2009a, 2011b). This means that '%s' has the undocumented feature to act like '%e' when it gets numbers as input. Strange.
Anyhow, Hamilton asks for an omitted leading zero and a 2 digit exponent. While the first is ugly and provokes unexpected errors, such that it will hopefully not implemented, the second is the default in non-PC versions of Matlab and in the newest release R2013a.
@Pourya: And obviously your assumption is not really wrong. Thanks for this interesting new piece of information.
Of course TMW did not implementfprintf from scratch but relies on existing libraries. Therefore even known bugs like buffer overflows and other undocumented features like %s with numbers appear in Matlab.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
0 Comments
Sign in to comment.