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 ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: Change the format of text file generated from MATLAB code
Posted: Feb 25, 2013 10:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"dhiraj " <dhirajsingla15@gmail.com> wrote in message
news:kge1n2$1c4$1@newscl01ah.mathworks.com...
>
>> 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.

>
> Thanks for your reply.
>
> But when I use this, my text file loose the original data and gives me
> 112.000 101.000
> 114.000 109.000 120.000 50.000 54.000 50.000 54.000 46.000 105.000 110.000
> 99.000, these random numbers.
>
> I also tried using above code in the code, where I am actually generating
> the file, though it displays numbers in the format I want, but in the
> saved text file they are still in the format of 6.89000+002.


That suggests the variable out contains the string:

out = 'permx2626.inc'

Those "random numbers" are the ASCII values for the characters that make up
that string.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




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.