필터 지우기
필터 지우기

index exceeds matrix dimension

조회 수: 1 (최근 30일)
sbei arafet
sbei arafet 2016년 3월 21일
편집: Adam 2016년 3월 21일
Hi i tried this code but it says that index exceeds matrix dimensoin
fgx=fg(:,1);% Foreground or object pixels
fgy=fg(:,2);
for i = 1:size(fgx,1)
obj_pixels(i)=im(fgx(i),fgy(i));% Extract values of foreground pixels
end
sizes:
size(fgx)=10941x1
size(fgy)=10941x1
size(fgx,1)=10941
i=129
i don't know why i is stoped only on 129
thanks in advance
  댓글 수: 1
Adam
Adam 2016년 3월 21일
편집: Adam 2016년 3월 21일
Without being able to run the code I suspect that the index that is exceeding the matrix dimension is not 'i' as an index to fgx or fgy, but the result of fgx(i) or fgy(i) exceeds the dimensions of 'im' when you try to index into it using these.
What is the size of 'im' and what are the values of fgx(129) and fgy(129)?

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

답변 (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