I need to loop a code i was given

6 vues (au cours des 30 derniers jours)
August Namuth
August Namuth le 28 Juin 2021
Commenté : August Namuth le 29 Juin 2021
I was given a code that was tested on a single participants data to see if it would do what we were intending it to do (defining baseline timeframe), now I need to loop the code to be able to run all of my participants. This is the current code with the participant number included.
raw(20).draw %see this one
stim = nirs.design.StimulusEvents;
stim.name = 'Temp';
stim.onset = [35 raw(20).time(end)-35];
stim.dur = [1 1];
stim.amp = [1 1];
raw(20).stimulus('Temp') = stim;
figure; raw(20).draw %You can see the stim events
job = nirs.modules.TrimBaseline();
job.preBaseline = 10;
job.postBaseline = 10;
raw(20) = job.run(raw(20));
figure; raw(20).draw %see after remove the spikes
job = nirs.modules.KeepStims();
job.listOfStims = '';
raw(20) = job.run(raw(20))
figure; raw(20).draw
This is the error i get when i remove the participant idendifier (20) or try to replace it with (1:24)
Expected one output from a curly brace or dot indexing expression, but there were 24
results.
essentially i need to define the loop for this code that i have.
Thanks so much for helping out.

Réponses (1)

Jan
Jan le 28 Juin 2021
for k = 1:24
... your code, but replace "20" by k
end
  1 commentaire
August Namuth
August Namuth le 29 Juin 2021
Thanks so much!

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by