What would be the way to use one 3D array as index for other 3D array?
Show older comments
Hello, I have two 3D arrays a (3x5x4) and o (1x5x4). What I would like to achieve is to use o array as index for a. The struggle is when I use the function below it would take whole o array when creating new array x (1x5x4), maybe anyone has any idea. I thought about pagefun, but it works with only predefined functions.
a=rand(3,5,4)
o= cat(3,[2 5 1 2 4],[2 5 3 1 5],[2 2 2 4 4],[2 3 1 5 4])
x=a(2,o,:)
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!