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: Change the format of text file generated from MATLAB code
Replies: 5   Last Post: Feb 25, 2013 10:36 AM

Advanced Search

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

Posts: 3,919
Registered: 12/7/04
Re: Change the format of text file generated from MATLAB code
Posted: Feb 24, 2013 2:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Monday, February 25, 2013 7:45:08 AM UTC+13, dhiraj wrote:
> Hello
>
> I am generating a text file using MATLAB which looks something like this
>
>
>
> 6.9905301e+001 6.9193786e+001 7.0975918e+001 7.5127181e+001 7.7340259e+001 8.0573000e+001 8.3738719e+001 8.1974246e+001 7.9527688e+001 8.0201600e+001 7.9433180e+001 7.9606963e+001 7.8440122e+001 7.7089076e+001 7.7316589e+001 7.8372644e+001 8.1083666e+001 8.2169213e+001 8.0140552e+001 7.9732129e+001
>
>
>
> I want these numbers in the format of decimals only, no powers. For e.g. I want 699.053 rather than 6.9905301e+001 and so on.
>
> Is there any way of doing this using MATLAB?
>
> Thank you in advance


Depends what you are using for output:
fid=fopen(txtfile,'wt');
fprintf(fid,'%0.3f\n',out); % One per line
fclose(fid);
is one way to get what you want.



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.