Azzera filtri
Azzera filtri

Making a for loop

3 visualizzazioni (ultimi 30 giorni)
MadjeKoe
MadjeKoe il 13 Dic 2020
Commentato: MadjeKoe il 13 Dic 2020
Hi guys,
I want to put the last 4 sentences into a for loop, can someone please explain to me how to do this?? I've been reading a lot about them but I just don't know how to make them work.
OrientationGabor1 = res(:,9);
OrientationGabor2 = res(:,8);
OrientationGabor3 = res(:,7);
OrientationGabor4 = res(:,6);
Targets = res(:,1);
Responses = res(:,2);
ResponseError = res(:,3);
TargetOrientationGabor1 = OrientationGabor1(Targets==1);
TargetOrientationGabor2 = OrientationGabor2(Targets==2);
TargetOrientationGabor3 = OrientationGabor3(Targets==3);
TargetOrientationGabor4 = OrientationGabor4(Targets==4);

Risposta accettata

Walter Roberson
Walter Roberson il 13 Dic 2020
It isn't a good idea. You are better off using cell arrays,
OrientationGabor = res(:,[9 8 7 6]);
TargetOrientationGabor = cell(4,1);
for T = 1 : 4
TargetOrientationGabor{T} = OrientationGabor(Targets == 1, T);
end

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by