Trend values of a 3d matrix having nan values

126 views Asked by At

I have a 3D matrix (19-by-21-by-23) of mean AOD values. My dataset consists of NaN values at many positions in the matrix. I wish to calculate the trend of each grid of the matrix, but I am somehow getting incorrect results and mostly NaN value as the trend. Help me in correcting the code. The code I wrote is below:

y=1:21;

% = mat2cell(y,1*ones(1,1),21);
% Mcell = mat2cell(aa,19,repmat(1,21,1));

kq= zeros(19,2);
X = mat2cell(winter,1*ones(19,1),21);
for i=1:19;
    for k=1:23;
        u(i,:,:)= winter(i,:,:);
        kq(i,:,:)= polyfit(u(i,:,:),y,1);
    end
end
0

There are 0 answers