error when using clabel(C,h)

조회 수: 13 (최근 30일)
Li Xuan
Li Xuan 2018년 5월 9일
댓글: Christian H. Voßschulte 2018년 12월 17일
when I use clabel as follow:
>> [X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
>> [C,h] = contour(X,Y,Z);
>> clabel(C,h)
It gives me an error: Error using clabel (line 77) Not enough contour handles. Can anyone tell me how to fix it?
  댓글 수: 1
Star Strider
Star Strider 2018년 5월 9일
Your code runs for me without error in R2018a. I cannot reproduce the problem.

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

답변 (2개)

Akira Agata
Akira Agata 2018년 5월 10일
Maybe you have closed your figure window before executing clabel(C,h).
  댓글 수: 1
Christian H. Voßschulte
Christian H. Voßschulte 2018년 12월 17일
Had the same problem, fixed it!
Thanks.

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


Carmen Schüssling
Carmen Schüssling 2018년 6월 5일
Hi guys,
I have the same problem and I'm using the latest Matlab version R2018a. I am actually using the clabel(C,h,v) command with v being the vector of labels that I want. Here is my minimum working example:
[C,h]=contourfm (lat, lon, data);
v = [0:2:50];
clabel (C, h, v);
I also tried clabel(C, v, Name, Value) options and it gives the same error;
Once the figure is plotted, I do clear C and h because I'm using them in the next figure. That shouldn't be a problem though (or is it?) because it happens quite a few lines after the clabel command.
Thanks for your help!

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by