how can I get the mean of each two columns of a matrix ?
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Niki
am 8 Jul. 2016
Kommentiert: Star Strider
am 8 Jul. 2016
I have a big matrix and I want to get the average of each 2 columns,
Is there any function to do that ?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 8 Jul. 2016
I’m not quite sure what you want.
See if this works for you:
M = randi(99, 10);
RM = reshape(M, 10, 2, [])
Mmean = mean(RM,2)
2 Kommentare
Star Strider
am 8 Jul. 2016
I forgot a squeeze call. This will do what you want, and should work with any matrix:
M = randi(99, 10); % Create Data
RM = reshape(M, size(M,1), 2, []) % Reshape
Mmean = squeeze(mean(RM,2)) % Desired Result
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Logical 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!