How to import files in bulk and loop over them
Mostra commenti meno recenti
Hi,
I am working with a large data set with csv files for different participants.
I have a multilayered issue I am looking to solve. First, I have the following code snippets which I would like to combine into one script. Unfortunately I have no luck creating loops which is why I am looking for help.
1) I need to import multiple participant data files (csv files) into Matlab. For each of these files I would like to import columns column 7 - 27 (21 columns in total). This should result in a matrix of 21 columns for each participant.
2) Next, I need to run the following code over all columns (column_n) of each participants imported matrix:
block_size = 512;
N = block_size*ceil(numel(column_n)/block_size);
column_n (end+1:N) = NaN;
windows_1n = reshape(column_n,512,[])
This should yield a several variables (windows) for each participant (for participant 1: "windows_1A", "...", "windows_1n").
3) Then, I would like to run the following code over each of those variables:
[m,n] = size(ctpz_windows);
F = zeros(n,1);
for i = 1:n
r = windows_n(:,i);
F(i,1) = dfaedit(r,0,0,0);
end
H_all_n = [H_all_n,F]
This way I should receive a matrix variable for each participant (for participant 1: "H_all_1", "..." , "H_all_n").
I hope this isnt too much. Any help with automating this process would be very much appreciated.
Thank you!
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Entering Commands in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!