How to change one dinmension list to two dimensions array with function "ind2sub"?

I have a vector but I need to construct a new array nXm and take his elements from the vector using "ind2sub" fuction

1 Kommentar

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...

Antworten (1)

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?

Diese Frage ist geschlossen.

Tags

Gefragt:

am 6 Okt. 2016

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by