I have a 500x8x4 matrix, lets call this X, and I have a 500×1 vector, lets call it Y, the latter contains numbers between 1 and 8. These numbers indicate the number in each row that I want from the matrix X. So by picking a number in each row of matrix X, I need to get a matrix that is 500×4, lets call it Z. I dont know how to get this vector Z, in a quick way (not using a loop). I know I should do it with sub2ind but I dont know how. Thank you for your help.
MATLAB: Sub2ind, picking specific values from a 3d matrix
sub2ind
Related Question
- Error using ==> sub2ind at 58 Out of range subscript.
- Code Vectorization in custom layer
- How to vectorize the find function
- Hello ! can anybody tell me where am wrong.i have 179789 by 3 dimensions matrix. when am trying to get sum of all three axis to get one column vector the result is 1 by 179789 , but the desired result is 179789 by 1. looking for kind response
- Reshape many submatrices to form a new matrix
- Retrieve value from specific location of matrix
Best Answer