Is there a way to display values of a matrix (size = [m,n]) with exactly
m rows and n columns (as with imagesc) AND Nan as empty patches (as with
pcolor) ?
Thanks in advance, Yves
old = magic(10)
new = NaN(10)
new(4:6,4:6) = old(4:6,4:6)
"old" is a 10x10 matrix, if I want to see the row 4-6 and columns
4-6, I can go old(4:6,4:6)
You can insert that "windowed" 3x3 matrix into a matrix of 10x10
NaN's; i.e NaN(10).
Not sure if that was what you are after or not.
cheers---joe
Hi Yves,
a couple of weeks ago I was trying to accomplish the same thing as you
want to do. It would certainly be a nice feature of the imagesc function.
I used the following workaround that in my case gave very nice results:
1. replace the NaN's in your data with a value slightly larger than the
largest value of your data
maxval = max(data(:));
data(isnan(data)) = maxval + maxval/10;
2. Plot this data as you usually do
imagesc(data);
3. Now comes the trick: customize your colormap such that the largest
value of your data is painted white
% for making NaN values white
colordata = colormap;
colordata(end,:) = [1 1 1];
colormap(colordata);
I hope this works for you too.
Greetz,
P.
I have tried your suggestions : thanks ! I found also that adding an
extra row and an extra column could "fool" pcolor (used with shading
flat option) into displaying exactly the number of pixels of the
original data.
Cheers, Yves
Yves Gaudemer <gaud...@ipgp.jussieu.fr> wrote in message <gaudemer-E4DC49...@vishnu.jussieu.fr>...
> try
> h=imagesc(X,Y,C)
> set(h,'alphadata',~isnan(C))