Making a for loop
1 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!