how to create a vector with known indices numbers
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!