means of multiple vectors from different matrices
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello I am trying to create a mean vector from multiple vectors (n=21) in 20 different matrices. Haven't used Matlab in a while so would greatly appreciate some help.Thanks!
0 Kommentare
Akzeptierte Antwort
Matt Fig
am 4 Mär. 2011
You will need to explain better what you want to do. Give a small example, say 3 matrices, and show what you want to get at the end.
Your example kinda clarifies, but not enough. How is the data stored? Is each chemical a row or column? Say columns.
Say Na is stored in the first column of all matrices and you want the mean:
A = magic(3); % Day 1
B = hankel(1:3); % Day 2
C = toeplitz(1:3); % Day 3
mn = sum([A(:,1);B(:,1);C(:,1)] )/9;
Now depending on how the matrices are stored and named, there could be a better way. For example, using the above matrices:
save matrices A B C
X = load('matrices')
Bigmat = cell2mat(struct2cell(X));
mean(Bigmat) % Column means.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!