help me to solve this
조회 수: 1 (최근 30일)
이전 댓글 표시
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163805/image.png)
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
댓글 수: 0
답변 (1개)
Walter Roberson
2017년 5월 6일
Replace
H=[H,j]; %H is an array.
with
H{i}(end+1) = j;
댓글 수: 5
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?
참고 항목
카테고리
Help Center 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!