Loop calculation and output

1 Ansicht (letzte 30 Tage)
siri meka
siri meka am 11 Feb. 2022
Kommentiert: Yongjian Feng am 11 Feb. 2022
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;

Akzeptierte Antwort

Yongjian Feng
Yongjian Feng am 11 Feb. 2022
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 Kommentare
siri meka
siri meka am 11 Feb. 2022
thanks a ton worked
Yongjian Feng
Yongjian Feng am 11 Feb. 2022
Great.
Accept the answer please then.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by