From: Cindy on 14 Jun 2010 14:04 Hi, Could anyone please tell me how to print 0.00123 in a file as 1.23-03 in Matlab? It seems %3.2e gives me 1.23-003. Thanks a lot! Cindy
From: dpb on 14 Jun 2010 14:09 Cindy wrote: > Hi, > > Could anyone please tell me how to print 0.00123 in a file as 1.23-03 in > Matlab? It seems %3.2e gives me 1.23-003. No way to suppress the 3-digit exponent other the postprocess a string... --
From: Cindy on 14 Jun 2010 14:17 I see. Thanks! dpb <none(a)non.net> wrote in message <hv5rde$f4t$1(a)news.eternal-september.org>... > Cindy wrote: > > Hi, > > > > Could anyone please tell me how to print 0.00123 in a file as 1.23-03 in > > Matlab? It seems %3.2e gives me 1.23-003. > > No way to suppress the 3-digit exponent other the postprocess a string... > > --
From: us on 14 Jun 2010 14:47 "Cindy" <xzhan2(a)fhcrc.org> wrote in message <hv5quo$7de$1(a)fred.mathworks.com>... > Hi, > > Could anyone please tell me how to print 0.00123 in a file as 1.23-03 in Matlab? It seems %3.2e gives me 1.23-003. > > Thanks a lot! > Cindy one of the (more tedious) solutions s=sprintf('%3.2e',0.00123); s=strrep(s,'e-0','e-') % <- or REGEXPREP % s = 1.23e-03 us
From: Doug Schwarz on 14 Jun 2010 17:46
dpb wrote: > Cindy wrote: >> Hi, >> >> Could anyone please tell me how to print 0.00123 in a file as 1.23-03 >> in Matlab? It seems %3.2e gives me 1.23-003. > > No way to suppress the 3-digit exponent other the postprocess a string... Not true. Only Windows uses 3 digits so an excellent solution would be to change your platform. ;-) -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address. |