Calculate mean from three different matrices when condition applies
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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');
0 Kommentare
Antworten (1)
Image Analyst
am 29 Sep. 2014
Please read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
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 Kommentare
Image Analyst
am 29 Sep. 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.
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!