Change order in an Array using a second array

조회 수: 4 (최근 30일)
alessandro montaghi
alessandro montaghi 2018년 12월 18일
댓글: alessandro montaghi 2018년 12월 18일
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
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.
alessandro montaghi
alessandro montaghi 2018년 12월 18일
Thanks for the tips!

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2018년 12월 18일
  댓글 수: 2
alessandro montaghi
alessandro montaghi 2018년 12월 18일
thanks!
madhan ravi
madhan ravi 2018년 12월 18일
편집: madhan ravi 2018년 12월 18일
Anytime :) , if my answer worked make sure to accept the answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by