Change order in an Array using a second array

4 visualizaciones (últimos 30 días)
alessandro montaghi
alessandro montaghi el 18 de Dic. de 2018
Comentada: alessandro montaghi el 18 de Dic. de 2018
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 comentarios
Stephen23
Stephen23 el 18 de Dic. de 2018
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 el 18 de Dic. de 2018
Thanks for the tips!

Iniciar sesión para comentar.

Respuesta aceptada

madhan ravi
madhan ravi el 18 de Dic. de 2018
  2 comentarios
alessandro montaghi
alessandro montaghi el 18 de Dic. de 2018
thanks!
madhan ravi
madhan ravi el 18 de Dic. de 2018
Editada: madhan ravi el 18 de Dic. de 2018
Anytime :) , if my answer worked make sure to accept the answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by