Filter löschen
Filter löschen

Making a for loop

3 Ansichten (letzte 30 Tage)
MadjeKoe
MadjeKoe am 13 Dez. 2020
Kommentiert: MadjeKoe am 13 Dez. 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);

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 13 Dez. 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
  1 Kommentar
MadjeKoe
MadjeKoe am 13 Dez. 2020
Thank u very much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by