필터 지우기
필터 지우기

Making a for loop

조회 수: 3 (최근 30일)
MadjeKoe
MadjeKoe 2020년 12월 13일
댓글: MadjeKoe 2020년 12월 13일
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);

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 13일
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
MadjeKoe
MadjeKoe 2020년 12월 13일
Thank u very much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by