Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: scientific notation
Replies: 4   Last Post: Jul 18, 2014 2:53 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,231
Registered: 6/7/07
Re: scientific notation
Posted: Jul 18, 2014 1:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 07/18/2014 12:29 PM, Will wrote:
> I have a script that formats multiple data sets and plots them in a
> loop. Everything works perfectly but I would like the title to look
> neater. This is how it is now:
>
> title(sprintf('%3.2f Hz',F(k)))
>
> where F(k) contains the different values that the graphs are titled
> with. The titles become things like 0.16 Hz which is fine but some are
> more like 100856.08 Hz. I would like all the titles to be expressed in
> scientific notation (i.e. 1.60e-1 Hz or 1.01e5 Hz). Any one have any ideas?


Use %e or %g instead of %f. You can control width and precision as desired.

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.