0
votes

I'm using imagesc multiple times to plot some data on the same plot (figure).

At the end of those iterations I get the desired plot. I wish to get the entire information available by the cursor:

(see image here: plot and cursor info)

But I don't want to get the information about a specific location (x,y), but to get a matrix containing all info: x,y,index, r, g, b - for every x,y. That is, a size(x) * size(y) * 4 matrix containing the entire data.

Is that possible?

1
Wouldn't that be size(x) * size(y) * 6? (x, y, index, red, green, blue)? - Suever
Does this information come from multiple imagesc objects? - Suever

1 Answers

0
votes

I'm very close, but I'm still getting something wrong with the scaling of the colors... I'll have another look at it tonight.

% Create random image
m=rand(180);
im=imagesc(m);

% Extract indices
Index=im.CData';

% Get RGB colors
cm=colormap;
a = floor(Index'*length(cm));
RGB=permute(ind2rgb(uint16(a),cm),[2 1 3]);

This is just ever so slightly off from the actual RGB values, but the indexed values correspond to those of the figure. Note that I transposed the CData to get it fro ij mode to xy mode.