MATLAB: How to go about generating a colormap from a matlab file containing RGB values

colormap rgb

Hi all !
I'm really stuck on a problem I would appreciate help with :
I have a matlab file containing 359 variables where each variable consists of a 360 x 3 matrix of double RGB values . For example , variable 1 looks like this :
1 1 1
1 1 1
1 1 1
1 1 1
1 0.73 1
1 0.76 1
.
.
.
.
.
and so on until row 360 .
My question is how can I go about loading these values into a matrix from which I can generate a colormap?
I have loaded values from a structure into a matrix and represented it as a colormap pretty easily before but my issue here is that I have three RGB values for each row and I don't know how to 'combine' them to get a number which represents a color (if it is even necessary for me to do that).
Many thanks in advance !
Saba

Best Answer

cmap = unique(YourArray, 'rows');
or, better,
cmap = uniquetol(YourArray, 1, 'ByRows', true, 'DataScale', 0.004);
cmap is now your colormap.