Extracting a vector from a 3d array
58 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi, I have a 3d array called 'A' of size (l,m,n)=12x15x3648.
I want to extract all 3648 values for a given index (l,m) as a single column vector. Doing A(7,8,:) for example outputs many individual answers and is not useful. I would like them in a vector which is 3648 elements long.
Any help is appreciated. Thanks.
0 Commenti
Risposta accettata
the cyclist
il 29 Apr 2014
Modificato: the cyclist
il 29 Apr 2014
Two alternatives:
squeeze(A(7,8,:))
and
permute(A(7,8,:),[3 1 2])
3 Commenti
Gianmarco Venditti
il 19 Ott 2023
Why doing something like:
X = A(:,7,8) you have vector ( a one index object)
while
X = A(7,8,:) produce a 4-D tensor? (Still have 4 index)
the cyclist
il 19 Ott 2023
Can you upload an example of an array A where you see that happening? You can attach a MAT file using the paper clip icon in the INSERT section of the toolbar.
Più risposte (2)
ABHIJITH U V
il 20 Nov 2018
Hello
I would like to extract all the values 468 from a 3 d - array of size (2,2,468) into a vector. How to do this ??
0 Commenti
Giorgio Sperandio
il 18 Giu 2020
Very interesting,
Would it be possible to loop the squeeze function in order to obtain the 3648 values from all the l,m indexes?
Thanks
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing 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!