Calculate mean from three different matrices when condition applies

조회 수: 1 (최근 30일)
Hana
Hana 2014년 9월 29일
댓글: Image Analyst 2014년 9월 29일
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