How do i find the standard deviation of every row of a 12*18 cell array?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
How do I find the standard deviation of every column across each row of a 12*18 cell array?
Every cell contains a 69*69 double, and I want the output to be a 12*1 cell array, with each cell being a 69*69 double.
Find the attached 12*18 cell array.
c = load('mean.mat')
c.z{2,18}
8 Kommentare
Image Analyst
am 30 Jan. 2023
"Cell 1x1 of the 69x69 output matrix will be..." <=== No. You said the output matrix is 12 by 1, not 69 by 69.
Is the stddev of the 69x69 matrix the stdev of all the non-nan values in the whole array, or do you want a 69x1 array which has the stdevs of each row in the 69x69 array?
Antworten (1)
Sulaymon Eshkabilov
am 30 Jan. 2023
Her is one solution:
C = load('mean.mat').z;
S =C;
for ii = 1:12
for jj=1:18
IDX = isnan(C{ii,jj});
S{ii,jj}(IDX)=0;
end
end
%%
ZS1 = cellfun(@std, S, 'UniformOutput', false);
ZS2 = cellfun(@std, ZS1, 'UniformOutput', false);
ZS2 = ZS2.';
ZSS = num2cell((std(cell2mat(ZS2)).')); % ANSWER
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!