Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Help with creating a for loop

조회 수: 1 (최근 30일)
Matlab1364
Matlab1364 2017년 5월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
How do I create a for loop for the function below, where the Block numbers go from 1 to 5 and the Trial numbers vary with each block. Some have up to 10 trials and some of them less.
A11=find((Block==1 & Trial==1)==1);
A12=find((Block==1 & Trial==2)==1);
A21= find((Block==2 & Trial==1)==1);
A22= find((Block==2 & Trial==2)==1);
  댓글 수: 2
KSSV
KSSV 2017년 5월 29일
Question is not clear.......elaborate it.
Stephen23
Stephen23 2017년 5월 29일
"A frequent use of the eval function is to create sets of variables such as A1, A2, ..., An, but this approach does not use the array processing power of MATLAB and is not recommended. The preferred method is to store related data in a single array"

답변 (1개)

ES
ES 2017년 5월 29일
BlockCount=5;
Trials = 20;
for iLoop1=1:BlockCount
for iLoop2:1:Trials
A(iLoop1, iLoop2) = find((iLoop1==1 & iLoop2==1)==1);
end
end

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by