Iteration in the text(comment) part of an fprint loop

So in the value part of my fprintf statement (the T1(k)...TN(k) section) , the (k) increases however in the written part (the T(k) section) the (k) just remains at the same value. Is there a way of making the text part increase with the same rate as the value part.
for k=3:N
fprintf('T(k)=\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t%10.10s\t\n',HotTemp,T1(k),T2(k),T3(k),T4(k),T5(k),T6(k),T7(k),T8(k),T9(k),T10(k),T11(k), ColdTemp);
end

 Respuesta aceptada

per isakson
per isakson el 17 de Mzo. de 2015
Editada: per isakson el 17 de Mzo. de 2015
Replace
fprintf('T(k)=\t%10.10s\t%10.10s...', HotTemp, ...
by
fprintf('T(%d)=\t%10.10s\t%10.10s...', k, HotTemp, ...
and what is %10.10s supposed to do? Why not %10.4f or similar?

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Mzo. de 2015

Editada:

el 17 de Mzo. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by