help me to solve this

조회 수: 1 (최근 30일)
Ad
Ad 2017년 5월 6일
편집: Ad 2017년 5월 7일
I array={2,5,7,12} ; D is an Image attached
H=[];
for i=1:4
for j=1:10
if(D(I(i),j)<=10)
H=[H,j]; %H is an array.
end
end
I am getting results like 2 12 5 7 5 6 7 2 12
I want something like this. I don't know to store it.
H(1):2 12
H(2):5 7
H(3):5 6 7
H(4):2 12

답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 6일
Replace
H=[H,j]; %H is an array.
with
H{i}(end+1) = j;
  댓글 수: 5
Walter Roberson
Walter Roberson 2017년 5월 7일
When it stops due to the error, please show
max(I)
class(I)
size(D)
size(H)
i
j
Question: why is it that your code
if(D(I(i))<=10)
does not depend upon j?
Ad
Ad 2017년 5월 7일
Sorry.
if(D(I(i),j)<=10)
Size of D 12*12

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by