Error using ==> sub2ind at 58 Out of range subscript.

조회 수: 2 (최근 30일)
LuMig
LuMig 2014년 3월 21일
답변: LuMig 2014년 3월 24일
Hallo, I am trying to use sub2ind but I am getting :Error using ==> sub2ind at 58 Out of range subscript. My code=
n = size(X ,2);
C = size(Meansi,2);
jj = sub2ind([C n], Y, (1:n)');
C=8 ,n=8
Y is a 8x1 matrix Y= 9 7 5 8 4 8 2 5
X=8X8 matrix of double.
Could any one please help.Thanx

채택된 답변

Roger Stafford
Roger Stafford 2014년 3월 21일
The first value of Y, namely 9, is out of range for a subscript in an 8 x 8 matrix. That is undoubtedly what led to the error message.

추가 답변 (1개)

LuMig
LuMig 2014년 3월 24일
Thank you...All the best

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by