Loop calculation and output
1 次查看(过去 30 天)
显示 更早的评论
i have 170 files of eeg recording. i want output of each file to be stored in a seperate excel file. i am not sure how to do this. pls help
My code to initiate is as below:
txtFiles = dir('*.txt') ;
l=length(txtFiles);
N = l*10 ;
Bandsheet = zeros(N,8);
PSDSheet1 =zeros(N,16);
PSDSheet2 =zeros(N,16);
PSDSheet3 =zeros(N,16);
for n=1:170
filename = ['00000460_', int2str(n), '.txt'];
x=load(filename);
figure;
0 个评论
采纳的回答
Yongjian Feng
2022-2-11
You meant this:
txtFiles = dir('*.txt') ;
l=length(txtFiles);
N = l*10 ;
Bandsheet = zeros(N,8);
PSDSheet1 =zeros(N,16);
PSDSheet2 =zeros(N,16);
PSDSheet3 =zeros(N,16);
for n=1:170
filename = ['00000460_', int2str(n), '.txt'];
x=load(filename);
figure;
% then you are going to update Bandsheet, PSDSheet1, etc here?
% and you want to write them into different excel files?
fname = ['00000460_', int2str(n), '.xlsx'];
writetable(Bandsheet, fname, 'Sheet', 'Bandsheet');
writetable(PSDSheet1, fname, 'Sheet', 'PSDSheet1');
writetable(PSDSheet2, fname, 'Sheet', 'PSDSheet2');
writetable(PSDSheet3, fname, 'Sheet', 'PSDSheet3');
end
6 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!