Change order in an Array using a second array
3 次查看(过去 30 天)
显示 更早的评论
I am new in Matlab (sorry)
I have to arrays a= [10, 20, 30, 40, 50] and p = [5, 3, 1, 2, 4]. I am looking a method to change the order of a in function of p (this array is an index vector). For example
newa = [50, 30, 10, 20, 40]
2 个评论
Stephen23
2018-12-18
Very basic MATLAB concepts, like how to use indexing, are explained in the introductory tutorials:
Rather than spending time registering on this forum, writing a question, waiting for some random stranger to help you with very basic MATLAB concepts... you can actually learn lots of important and useful concepts yourself simply by doing those tutorials.
采纳的回答
madhan ravi
2018-12-18
a(p)
2 个评论
madhan ravi
2018-12-18
编辑:madhan ravi
2018-12-18
Anytime :) , if my answer worked make sure to accept the answer.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!