Deciphering an Error message

What does the following error message mean?
??? Index exceeds matrix dimensions.
Error in ==> clabel>inline_labels at 172
    if strcmp(get(h(1), 'Type'), 'patch') && ~strcmp(get(h(1), 'FaceColor'),
    'none')
Error in ==> clabel at 111
                    h = inline_labels(cax, cs, varargin{:});
Thank you.

 채택된 답변

Walter Roberson
Walter Roberson 2012년 4월 2일

0 개 추천

Brooke, for some values of n, there would be no data below the choosen n, and so there would be no contour line drawn. The handle returned, h, would be empty. Feeding an empty handle to clabel causes the message you see.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 4월 2일

0 개 추천

x = rand(2,2)
x is now a 2x2 matrix.
If I try to get x(3,3):
x(3,3)
I'll get that error because x(3,3) doesn't exist since it's 2x2

댓글 수: 3

Brooke
Brooke 2012년 4월 2일
Thanks, Sean, but What I have written is
x = linspace(…,…,…);
y = linspace(…,…,…);
[x,y] = meshgrid(x,y);
z = ...;
n = input('Enter n: ');
m = [n,n];
[c,h] = contourf(x,y,z,m);
clabel(c,h)
for some values of n, the program works fine but for others the error message above is presented.
I don't understNd what's wrong :(
Sean de Wolski
Sean de Wolski 2012년 4월 2일
What are you entering for n?
Brooke
Brooke 2012년 4월 2일
It works when I enter say 1, 0.2, 0,5 etc but stops working when I entered anything greater than 3 (or maybe some tighter bound)...

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

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by