Calculate mean from three different matrices when condition applies

1 次查看(过去 30 天)
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');

回答(1 个)

Image Analyst
Image Analyst 2014-9-29
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 个评论
Hana
Hana 2014-9-29
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 2014-9-29
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by