How to change one dinmension list to two dimensions array with function "ind2sub"?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I have a vector but I need to construct a new array nXm and take his elements from the vector using "ind2sub" fuction
1 Comment
dpb
on 6 Oct 2016
OK, and what's preventing you from doing so?
We certainly can't tell you anything specific w/o some definition of which elements are in question and how it is to be determined that those are, indeed, the ones.
And, depending on the above, ind2sub might not even be needed or the best solution...
Answers (1)
Walter Roberson
on 6 Oct 2016
If your vector is V, then
[r, c] = ind2sub([n, m], V)
will give you the row (r) and column (c) indices into an n x m array that the elements of V represent.
But what do you want to do with the row and column indices once you have them?
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!