Colormap provided is invalid. Colormap should be a Px3 matrix with a maximum of 256 entries.

Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Colormap provided is invalid. Colormap should be a Px3 matrix with a maximum of 256 entries.

Post by matlab1 »

Colormap provided is invalid. Colormap should be a Px3 matrix with a maximum of 256 entries.
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

Re: Colormap provided is invalid. Colormap should be a Px3 matrix with a maximum of 256 entries.

Post by matlab1 »

solution :



A colormap is a matrix of values that define the colors for graphics objects such as surface, image, and patch objects. MATLAB® draws the objects by mapping data values to colors in the colormap.

Colormaps can be any length, but must be three columns wide. Each row in the matrix defines one color using an RGB triplet. An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. Typically, the intensities are double or single values in the range [0, 1]. A value of 0 indicates no color and a value of 1 indicates full intensity. For example, this command creates a colormap that has five colors: black, red, green, blue, and white.

Code: Select all

mymap = [0 0 0
    1 0 0
    0 1 0
    0 0 1
    1 1 1];
To change the color scheme of a visualization, call the colormap function to change the colormap of the containing axes or figure. For example, the following commands create a surface plot and set the colormap of the figure to mymap.

Code: Select all

surf(peaks)
colormap(mymap)

https://de.mathworks.com/help/matlab/ref/colormap.html



As you see in the above text, the colomap must have three columns.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests