how to create a vector with known indices numbers

I have
vector = [1 3 4 6 7 7 8 90 8]
positions = [1 5 8]
How can I write a new_vector having the same lentgh as vector positions and containing the numbers of vector in the corresponding positions?

 Réponse acceptée

Adam
Adam le 19 Oct 2021
result = vector( positions );
will give you this, if what you mean is you want the numbers from those positions of vector rather than that you want them in those positions of the result vector too.

Plus de réponses (0)

Catégories

En savoir plus sur Vehicle Dynamics Blockset dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by