필터 지우기
필터 지우기

Why do I get this error in the code?

조회 수: 1 (최근 30일)
Samuel Davies
Samuel Davies 2015년 7월 26일
답변: Walter Roberson 2015년 7월 26일
So I put this code in from an example, http://au.mathworks.com/help/matlab/ref/colormap.html, and changed the surf to mesh. I get this error: Subscript indices must either be real positive integers or logicals.
figure
ax1 = subplot(2,1,1);
mesh(peaks)
colormap(ax1,spring)
ax2 = subplot(2,1,2);
mesh(peaks)
colormap(ax2,winter)
This is the error message
Error in surf (line 4)
colormap(ax1,spring)
I don't know what is wrong. Thanks.
  댓글 수: 1
Walter Roberson
Walter Roberson 2015년 7월 26일
You should not name your file surf.m as that is going to conflict with the MATLAB surf() command.

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

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 26일
In the code or script not shown, you possibly have created a variable named "colormap".

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by