No of cases = 112; (112*9=1008)
in each case i have 9 obsevations( but there are missing values in between for which matlab treats them as Nan); so total i have an array of 1008*1
i calculted mean of 9 observations for each case. Now i want to calculate deviation of each observation( 9 observations) from the mean of that particular case.
M = strcat('iva','.xlsx' ); %% read excel file , iva file consists of 1008*1 array
M1 = xlsread(M); mean_iva = zeros(112,1); %% initialising matrix
for ii = 1:9:1008 mean_iva(ii,1)= nanmean(M1(ii:ii+8)) %% calculating mean for each case
end B = mean_iva(mean_iva~=0); %% MEAN for all 112 cases
dev = zeros(1008,1);
Best Answer