Calculate mean from three different matrices when condition applies

1 visualización (últimos 30 días)
Hana
Hana el 29 de Sept. de 2014
Comentada: Image Analyst el 29 de Sept. de 2014
I want to calculate mean from the images S1,S2,S3 where land is equal to one.Is it a correct way of writing it? and later I want to have the scatterplot. I want to have S1-mean, S2-mean and S3-mean on my x axis.
S1 = imread('vv240_60.tif'); S2 = imread('hv104_60m.tif'); S3 = imread('hv240_60.tif'); land = imread('land.tif');
Mean = nanmean(S1,S2,S3( land == 1 ));
x = S1-Mean; % how can I merge the data of all 3 matrices for x? y = Tbv- ME_crop_v;
scatter(x,y,'MarkerFaceColor','g','MarkerEdgeColor','g');

Respuestas (1)

Image Analyst
Image Analyst el 29 de Sept. de 2014
Why are you using nanmean? Are there nans in the data? That's in the Stats toolbox I believe so I can't run it.
I'm not sure what two variables you're scattering. It looks like you're scattering the gray levels against y but I have no idea what y is or how to obtain it. Having millions of datapoints, because that's probably how many pixels you have, is not good for scatter - will probably take a very long time.
To get individual means you can do this
mean1 = mean(S1(land==1));
mean2 = mean(S2(land==1));
mean3 = mean(S3(land==1));
After that I don't know what to do because I don't know what y is and why you want millions of scatter points.
  2 comentarios
Hana
Hana el 29 de Sept. de 2014
Thanks for your reply. yes I have nan values thats why I used nanmean. Please dont bother about y. My question is that how I can plot x which is from 3 images?
Image Analyst
Image Analyst el 29 de Sept. de 2014
x is an image. What does it mean to "plot" it? Or to scatter it, when you need two things to scatter? I know how to display x (with image, imshow, or imagesc), but to plot it like a curve on an x,y chart? I don't know what that means. Please explain.

Iniciar sesión para comentar.

Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by