The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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));


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.