How to fix this error?

조회 수: 24 (최근 30일)
Rizwana
Rizwana 2014년 3월 10일
답변: pranshu saxena 2018년 6월 13일
cmap=menu('Choose a color','jet','hsv','summer','cool','spring','hot','autumn','winter','bone','copper','pink','lines','Gray');
contourf (x, y, z,50);
colormap (cmap);
It is throwing error which say's..
Error using colormap (line 58)
First argument must be a scalar axes or figure handle.
I know cmap is holding the position of the item in the list. I want the value so that i can use in in colormap
Thanks
Rizwana

채택된 답변

Dishant Arora
Dishant Arora 2014년 3월 10일
cmap=menu('Choose color','jet','hsv','summer','cool','spring','hot','autumn',...
'winter','bone','copper','pink','lines','Gray'); % menu returns index of selected choice.
map={'jet','hsv','summer','cool','spring','hot','autumn',...
'winter','bone','copper','pink','lines','Gray'};
colormap(map{cmap});
  댓글 수: 1
Rizwana
Rizwana 2014년 3월 10일
Thanks alot. I was trying to fix this error since morning... Thanks once again

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

추가 답변 (1개)

pranshu saxena
pranshu saxena 2018년 6월 13일
xx=rgb2gray(yellow_nuclei);% yellow_nuclei is an color image subplot(1,2,2); y=image(xx); title('Yellow Cytoplasmic Element'); imwrite(xx,'cyp.jpg'); colormap(y,hot), title('Yellow nuclei');
showing this error? First argument must be a scalar axes or figure handle.
Thanks in advance

카테고리

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