csvread Loop Input with Changing String Name
Afficher commentaires plus anciens
I am trying to read in several files that change depending on a) name, and b) task. An example file is:
'resp_signal_ben_15_brpm.csv'
Other files are the same but have either the name (ben) or the task (15 brpm) changed. I tried to make a few arrays containing the changing parameters, i.e.:
task = ['6_brpm','10_brpm','15_brpm','24_brpm','hold_breath','silent_talk']
name = ['ben','joe','bob']
Then create a nested loop that would insert the appropriate name and task:
for i = 1:3
for j = 1:6
a = csvread('resp_signal_',name(i),'_',task(j),'.csv');
subplot(2,3,i);
plot(a(:,2));
end
end
However, this does not work and I'm sure it probably has to do with the way csvread is taking in these arguments. Can anyone help me with an iterative way read in these files correctly?
1 commentaire
per isakson
le 17 Juin 2015
Try replace
a = csvread('resp_signal_',name(i),'_',task(j),'.csv');
by
a = csvread(['resp_signal_',name(i),'_',task(j),'.csv']);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!