Matrix Subtraction by taking mean of same matrix
Show older comments
I want to subtract of data which is of 413 X 264 and from taking a mean of same data with 45x45 matrix
My code is
winSz = [45,45]; % window size [width (x), height (y)]
[m, n] = size(HH_lin_0p2km);
winX0 = 1:winSz(1):n-winSz(1)+1; % starting index of x-values for each window
winY0 = 1:winSz(2):m-winSz(2)+1; % starting index of y-values for each window
xWin = 0:winSz(1)-1;
yWin = 0:winSz(2)-1;
for i = 1:size(HH_C,1)
for j = 1:size(HH_C,2)
HH_C = HH_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin)-nanmean(HH_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin),'all');
HV_C = HV_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin)-nanmean(HV_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin),'all');
end
end
And I am getting error as:
I am looking for output in 413x264 MATRIX
ndex exceeds the number of array elements. Index must not exceed 5.
Error in Soil_Moisture_Estimation (line 492)
HH_C = HH_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin)-nanmean(HH_lin_0p2km(winY0(i)+yWin, winX0(j)+xWin),'all');
Any one please help
Accepted Answer
More Answers (0)
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!