Loop calculation and output

2 visualizzazioni (ultimi 30 giorni)
siri meka
siri meka il 11 Feb 2022
Commentato: Yongjian Feng il 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;

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by