Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.
|
|
|
using fprintf more efficiently
Posted:
Jul 16, 2008 4:22 PM
|
|
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
|
|
|
|