How to pick elements of several arrays via assigned vector
Afficher commentaires plus anciens
Hi,
I have 3 arrays, and would like to form new array picking elements from these 3 arrays.
The picking is via my assigned vector.
The computation should be matrix computation, no for loop inside.
e.g.
-----
[input]
arr_i1 = [111,112,113,114; ...
121,122,123,124];
arr_i2 = [211,212,213,214; ...
221,222,223,224];
arr_i3 = [311,312,313,314; ...
321,322,323,324];
vec_i = [2,3,1,2];
[output]
arr_o = [211,312,113,214; ...
221,322,123,224];
-----
Your answer would be quite appreciated.
3 commentaires
KSSV
le 14 Juin 2021
How you got the output? Check the indices properly.
Also it is not advisable to have arr_i1,arr_i2 etc.
SALAH ALRABEEI
le 14 Juin 2021
what is exactly do you want! How the vec_i is related to the matrix index!
Warren Chuo
le 14 Juin 2021
Modifié(e) : Warren Chuo
le 14 Juin 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!