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: Save strings and numbers together
Replies: 4   Last Post: Mar 14, 2013 9:53 AM

Advanced Search

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

Posts: 8,100
Registered: 6/7/07
Re: Save strings and numbers together
Posted: Mar 14, 2013 9:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 3/14/2013 7:14 AM, Phil Roberts wrote:
...

> How do I increase the number of output columns in fprintf if "val" is
> changing each time? For example:

...

> I would like to add the %5.3f for each additional column in val
> automatically.


fmt=[repmat('%5.3f ',1,size(val,2)) '\n'];
fprintf(fid,fmt,val');

Salt to suit...NB the transpose operator on the array to output in row
order rather than internal column storage order.

--





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.