Info

This question is closed. Reopen it to edit or answer.

How to access A(1,2,2,3) of the multi dimensional array A, when I have [1,2,2,3]?

1 view (last 30 days)
I hoped A([1,2,2,3]) to be A(1,2,2,3) but Matlab gave me [A(1), A(2), A(2), A(3)]. What could I do to make it work?

Answers (1)

Guillaume
Guillaume on 27 Jun 2015
Edited: Guillaume on 27 Jun 2015
Convert your vector to a cell array and use cell array expansion to comma separated list:
v = [1, 2, 2, 3];
vascell = num2cell(v);
A(vascell{:})

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!