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

2 次查看(过去 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