how to create a vector with known indices numbers

1 回表示 (過去 30 日間)
Melissa Jones
Melissa Jones 2021 年 10 月 19 日
コメント済み: Melissa Jones 2021 年 10 月 19 日
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?

採用された回答

Adam
Adam 2021 年 10 月 19 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by