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: using fprintf more efficiently
Replies: 2   Last Post: Jul 16, 2008 5:34 PM

Advanced Search

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

Posts: 33
Registered: 7/27/07
using fprintf more efficiently
Posted: Jul 16, 2008 4:22 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dear all,

% example:
a.txt{1} ='aaa'; a.txt{2}='aaa'; a.txt{3}='aaa';
a.num1(1) = 3 a.num1(2)= 6; a.num1(3)= 9;
a.num2(1) = 30; a.num2(2)= 60; a.num2(3)= 90;


% can you write the following code without for-loop?
% ...only one fprintf command?
for i=1:length(a.txt)
fprintf('%s: %d, %d\n', a.txt{i}, a.num1(i), a.num2(i));
end


cheers
Daniel



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.