필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

output results to different excel sheets

조회 수: 1 (최근 30일)
Linden
Linden 2013년 8월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
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.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 15일
편집: Azzi Abdelmalek 2013년 8월 15일
for i = 1:5
X=y(:,i);
xlswrite('output',X,sprintf('factor_%d',i);
end
%or you can use
strcat('factor_',num2str(i))
  댓글 수: 2
Linden
Linden 2013년 8월 15일
Thanks very much. I actually tried sprintf('factor_%s',i). Didn't work.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 15일
편집: Azzi Abdelmalek 2013년 8월 15일
% sprintf('factor_%s',i) is for characters
e.g
i='r'
sprintf('factor_%s',i)
% for numbers use
i=3
sprintf('factor_%d',i)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by