M and T are 1024*366 matrix want to make a separate matrix that follow some condition?

조회 수: 1 (최근 30일)
M and T are 1024*366 matrix want to make a separate matrix that follow some condition
A=[];
nnn=1;
for i=1:1023
nn=1;
for j=1:965
if (T(j,i)>500 && T(j,i)<600)
A(nn,nnn)=M(j,i);
A(nn,nnn+1)=T(j,i);
end
end
nnn=nnn+4;
end
This error How can I solve?
Attempted to access T(1,967); index out of bounds because size(T)=[1024,966].

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 25일
If M and T are 1024 * 366 then why is your "j" loop running to 965? And since your "i" loop is running to 1023 and it is the first dimension that is as large as 1024, then why are you using "i" to index the second dimension of the matrix instead of the first ?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by