How can I create a numeric array using entries from my 3D matrix?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Thomas Veith
le 5 Juin 2019
Commenté : Thomas Veith
le 5 Juin 2019
If I have a 50x1x10 matrix, and I want to create a 10x1 numeric array, using the 50th entry from each of the 10 columns in the 3D matrix, how can I accomplish this?
I'm currently doing in manually using the following code (my 3D matrix is called 'C', my 10x1 array 'lastposition'), but I am sure there must be some way I can change the syntax for a less brute foce method, and also so that I can scale up to set of entries larger than 10.
elc1=C(50,1,1);elc2=C(50,1,2);elc3=C(50,1,3);elc4=C(50,1,4);elc5=C(50,1,5);elc6=C(50,1,6);elc7=C(50,1,7);elc8=C(50,1,8);elc9=C(50,1,9);elc10=C(50,1,10);
lastposition=[elc1;elc2;elc3;elc4;elc5;elc6;elc7;elc8;elc9;elc10];
Thank you in advance!
0 commentaires
Réponse acceptée
KALYAN ACHARJYA
le 5 Juin 2019
Modifié(e) : KALYAN ACHARJYA
le 5 Juin 2019
result=A(50,1,:);
numeric_array=result(:)
Check:
>> whos numeric_array
Name Size
numeric_array 10x1
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!