displaying the index of number
8 次查看(过去 30 天)
显示 更早的评论
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)}
0 个评论
回答(1 个)
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!