Standard deviation of multiple cell arrays
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Christoph Thorwartl
am 24 Jun. 2021
Kommentiert: Star Strider
am 24 Jun. 2021
I've figured out how to get the average of multiple cell arrays. M is a 1x19 cell
MEAN = mean(cat(3,M{:}),3)
This works well. Now I want to apply the same for the standard deviation:
SD= std(cat(3,M{:}),3)
However, the following error occurs:
>> SD= std(cat(3,M{:}),3)
Error using var (line 197)
W must be a vector of nonnegative weights, or a scalar 0 or 1.
Error in std (line 59)
y = sqrt(var(varargin{:}));
Could someone help me how to rewrite the code?
Thanks and best regards,
Christoph
0 Kommentare
Akzeptierte Antwort
Star Strider
am 24 Jun. 2021
I am not certain what ‘M’ actually is.
Try this —
M = {rand(5),rand(5),rand(5)} % Create 'M'
SD = std(cat(3,M{:}),[],3)
Supply an empty array [] for the weight argument and it should work.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional 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!