How to obtain a particular value from set of matrix
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a workspace with set of 40 matirx 131X160. I want to get the value of (59,127) in a form of single matrix (1X41) named new from all the matrix in one run. I have script defining all the matrices in the name Freq1Hz.
I used the below code but I couldnt get in the form of single matrix.
for i = 1:41
New = Freq1Hz(59,127,i)
end.
0 Commenti
Risposte (1)
Star Strider
il 27 Set 2021
If they are not already in some sort of array themselves, it would first be necessary to put them in one. Then extracting the element you want from each one is straightforward —
M1 = randn(131,160);
M2 = randn(131,160);
M3 = randn(131,160);
M4 = randn(131,160);
Mcat = cat(3,M1,M2,M3,M4);
CheckSize = size(Mcat) % Optional
Freq1Hz = squeeze(Mcat(59,127,:))
If they are in a cell array or are already concatenated (such as I do here), that would make this easier.
.
0 Commenti
Vedere anche
Categorie
Scopri di più su Operators and Elementary Operations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!