what is meant by index exceed matrics dimension?

조회 수: 1 (최근 30일)
g mathi
g mathi 2016년 11월 4일
댓글: Walter Roberson 2016년 11월 5일
when i run this code its showing error as index exceed matrix dimension.please help me. i also tried debugging.
  댓글 수: 3
g mathi
g mathi 2016년 11월 4일
i also tried that, but dont know to figure out the problem. where the dimension increased? how to solve?
Adam
Adam 2016년 11월 4일
If you are new to Matlab this is exactly the kind of basic problem you need to be able to learn how to solve and using the debugger and command line is the best way to do that. You ought to understand your own code and what it is supposed to do better than anyone else.

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

답변 (2개)

Thorsten
Thorsten 2016년 11월 4일
편집: Thorsten 2016년 11월 4일
If you have a 1 x 3 matrix
A = [6 7 9]
and try to access an element that does not exist, like A(2,3) or A(1, 4), you get the error: Index exceeds matrix dimension, because in the first case your index 2 exceeds the matrix dimension 1, and in the second case, your index 4 exceeds the matrix dimension 3.
  댓글 수: 2
g mathi
g mathi 2016년 11월 4일
i am new to matlab.say me where i need to change.help me.
Steven Lord
Steven Lord 2016년 11월 4일
If MATLAB was a pirate ship, this behavior that causes this error would be the equivalent of trying to walk to the 4th step of a plank that is 3 steps long.
You need either to use a longer plank (increase the length of the vector into which you're indexing) or to take fewer steps (use a smaller index into the vector.)
A = [1 2 3];
A(4) % this will throw the "Index exceeds matrix dimensions" error
A2 = [1 2 3 4]; % you're using a longer plank
A2(4) % and taking the same number of steps so this will work
A3 = [1 2 3]; % the plank is the same length as the first one
A3(3) % but you're taking fewer steps so this will work

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


Walter Roberson
Walter Roberson 2016년 11월 4일
Undefined function or variable 'eNodeB'.
Error in code (line 21)
p(time)=eNodeB(w,Rate(i_rate));
You have not provided us with what we need to test your code.
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 11월 5일
Error using fzero (line 241)
FZERO cannot continue because user-supplied function_handle ==> @(x)utility_UE(x,ii,pp) failed with the error below.
Undefined function 'utility_UE' for input arguments of type 'double'.
Error in code (line 25)
soln(i)=fzero(@(x) utility_UE(x,ii,pp),[0.001 1000]);
That is, we also need utility_UE
Walter Roberson
Walter Roberson 2016년 11월 5일
"how to solve this?"
... by posting the code for utility_UE along with any other of your routines that utility_UE calls.

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

카테고리

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