displaying the index of number

8 次查看(过去 30 天)
Prabha Kumaresan
Prabha Kumaresan 2018-1-3
评论: Stephen23 2018-1-3
If p=1:1000;
a=sort(p);
Could anyone tell me how to display index of p after sorting it.{(p(1)=1,P(2)=2;P(3)=3................................P(1000)=1000)}

回答(1 个)

KSSV
KSSV 2018-1-3
It is a striaght forward one, if you could have read the documentation part of sort. :(
a = rand(10,1) ;
[val,idx] = sort(a) ; % idx are the indices
idx
  5 个评论
jaah navi
jaah navi 2018-1-3
how to get a(1)=1,a(2)=2,.......

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by