Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

output results to different excel sheets

1 visualización (últimos 30 días)
Linden
Linden el 15 de Ag. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi I want to output my results to different excel sheets. All sheets share the same prefix plus a number to distingush them. For example,
for i = 1:5
X=y(:,i);
xlswrite('output',X,factor_i);
end
How can I make Matlab create sheets like factor_1, factor_2,...
Thanks.

Respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 15 de Ag. de 2013
Editada: Azzi Abdelmalek el 15 de Ag. de 2013
for i = 1:5
X=y(:,i);
xlswrite('output',X,sprintf('factor_%d',i);
end
%or you can use
strcat('factor_',num2str(i))
  2 comentarios
Linden
Linden el 15 de Ag. de 2013
Thanks very much. I actually tried sprintf('factor_%s',i). Didn't work.
Azzi Abdelmalek
Azzi Abdelmalek el 15 de Ag. de 2013
Editada: Azzi Abdelmalek el 15 de Ag. de 2013
% sprintf('factor_%s',i) is for characters
e.g
i='r'
sprintf('factor_%s',i)
% for numbers use
i=3
sprintf('factor_%d',i)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by