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: Unable to get new line fprintf
Replies: 5   Last Post: Mar 17, 2013 9:46 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,526
Registered: 12/7/04
Re: Unable to get new line fprintf
Posted: Mar 15, 2013 2:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Ravin " <ravin2288@yahoo.com> wrote in message
news:khvml9$j9l$1@newscl01ah.mathworks.com...
> Hi i have written a code to write data into a text file:
>
> fileID = fopen('testWrite.txt','w');
> mystring = 'aX';
> fprintf(fileID,'%s\n',['Name: ',mystring]);
> fprintf(fileID,'%d',21);
>
> I get the result:
>
> Name: aX21
>
> instead of
>
> Name: aX
> 21
>
> Can anyone explain this to me?


If you're using Windows, open the file in the MATLAB Editor or in Wordpad
instead of opening it in Notepad.

--
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-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.