From: anna Sarnelli on
Dear all,
I am a student and I am involving in the dovelopment of easy to use routine to manipulate images. My problem is that ,when I type colormap command, Matlab automatically opens a Figure. Is it normal?
If I type:
cmap=colormap(jet)
the program opens a Figure but I only want to retrieve the data of the jet map.
Why does it work in this way?
thanks a lot
anna
From: ImageAnalyst on
anna:

I don't know - that's just the way it works. You can try it this way:

cmap=jet
close(gcf);


From: Steven Lord on

"anna Sarnelli" <sarnelli.anna(a)gmail.com> wrote in message
news:hs0ovo$9kp$1(a)fred.mathworks.com...
> Dear all,
> I am a student and I am involving in the dovelopment of easy to use
> routine to manipulate images. My problem is that ,when I type colormap
> command, Matlab automatically opens a Figure. Is it normal?

Yes.

> If I type:
> cmap=colormap(jet)
> the program opens a Figure but I only want to retrieve the data of the jet
> map.
> Why does it work in this way?

Look at the help not for COLORMAP but for JET. In release R2010a, it says
in part:

JET, by itself, is the same length as the current figure's
colormap. If no figure exists, MATLAB creates one.

It's behaved that way as far back as I can remember. If you're just looking
to get the JET colormap of a particular length, use the 1-input syntax for
JET with an appropriate choice of the input argument M.

JET(M), a variant of HSV(M), is an M-by-3 matrix containing
the default colormap used by CONTOUR, SURF and PCOLOR.
The colors begin with dark blue, range through shades of
blue, cyan, green, yellow and red, and end with dark red.

There's no need to call COLORMAP at all. If you want to generate the JET
colormap the size of the default figure colormap, you can determine that
value without actually opening a figure:

nColors = size(get(0, 'DefaultFigureColormap'), 1);
cmap = jet(nColors);

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ