I need to loop a code i was given

6 visualizzazioni (ultimi 30 giorni)
August Namuth
August Namuth il 28 Giu 2021
Commentato: August Namuth il 29 Giu 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.

Risposte (1)

Jan
Jan il 28 Giu 2021
for k = 1:24
... your code, but replace "20" by k
end

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by