필터 지우기
필터 지우기

loop iteration of table in excel

조회 수: 10 (최근 30일)
Hashvi Sai
Hashvi Sai 2021년 7월 27일
댓글: Peter Perkins 2021년 7월 28일
Hi,
Im new to matlab.
I have a complex program of EEG data analysis. i get 6 outputs, each of which needs to be written in a different sheet in excel, without erasing the previous. which is the best suitable function? can someone pls help me with the code
TIA

답변 (2개)

Albert Bing
Albert Bing 2021년 7월 27일
xlswrite(filename, Data, sheet)
e.g.
A = randn(4,3,6);
filename = 'test.xlsx';
for i=1:6
xlswrite(filename, A(:,:,i), i);
end
  댓글 수: 1
Peter Perkins
Peter Perkins 2021년 7월 28일
xlsread and xlswrite are NOT recommended any more. readtable/writetable or readmatrix/writematrix are the way to go.

댓글을 달려면 로그인하십시오.


Dave B
Dave B 2021년 7월 27일
How about writetable? It has a 'Sheet' option:
t=readtable('patients');
t2=readtable('morePatients')
writetable(t,'foo.xls','Sheet',1)
writetable(t2,'foo.xls','Sheet',2)
  댓글 수: 2
Hashvi Sai
Hashvi Sai 2021년 7월 28일
hi Dave
How do i append?
Dave B
Dave B 2021년 7월 28일
Hashvi :
The writetable documentation page has an example with appending, I looks like it's as easy as specifying 'WriteMode', 'append' with the command but I haven't tried it. You can also write directly to a specific range. writetable has lots of options and a great documentation page with several examples, I recommend having a look !
(Alternatively, you could read, append, and write the whole thing, or you could try the xlsappend file exchange submission which looks quite popular)
Best ,
Dave

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by