MATLAB Answers

what is the result?

3 views (last 30 days)
diadalina
diadalina on 24 Oct 2017
Edited: KSSV on 24 Oct 2017
X a matrix 2 × n containing the coordinates of n points of the plan. How to obtain a matrix where the points are ordered by ascending order of the x-axis?

  0 Comments

Sign in to comment.

Accepted Answer

KSSV
KSSV on 24 Oct 2017
Edited: KSSV on 24 Oct 2017
n = 100 ;
X = rand(2,n) ; % some random data
[val,idx] = sort(X(1,:),'ascend') ; % sort x values (first row) in ascending order
X = X(:,idx) ;

  0 Comments

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!