Attempted to access x(1,2); index out of bounds because size(x)=[105760,1].

조회 수: 5 (최근 30일)
can you please solve this sir
for i=1:2
for j=2:len-1
x(j,i) = (x(j-1,i) + x(j,i) + x(j+1,i))/3 ;
end
end
i am getting error command Attempted to access x(1,2); index out of bounds because size(x)=[105760,1].
Error in highfrequencynoiseremoval (line 14)
x(j,i) = (x(j-1,i) + x(j,i) + x(j+1,i))/3 ;

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 31일
From the error message, it appears that your variable x is a a column vector 105760x1 . In your code you are trying to access x(1,2) which should be in the second column that doesn't exist
  댓글 수: 3
shivam verma
shivam verma 2019년 7월 3일
how you solve this problem can u tll me please. i m a beginner in the imag processing ..
Walter Roberson
Walter Roberson 2019년 7월 3일
The original poster of the question looks to have created x as a column vector somehow. That could have occurred if they had used (:) or reshape() to force it to be a column vector. It could also have occurred if they were not careful in how they deleted some data from the array. For example if they used
x(1:5) = [];
instead of
x(1:5,:) = [];

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by