Code covered by the BSD License  

Highlights from
Grab 2D points

image thumbnail

Grab 2D points

by

 

17 Aug 2007 (Updated )

This code is used to digitize 2d figures that you find in publications, journals, or simply scanned

C=sort_first_column_permute_second(A);
% This function sorts the first column in the ascending of an mx2 matrix, and permutes the second column according to the changes made in the sorting process. 
%Change the sort mode if you prefer to use it in descending order.
%  C=sort_first_column_permute_second([5 3 2 4 1;-1  0 2 1 1]')
function C=sort_first_column_permute_second(A);
C=A;
[m,n]=size(A);
[B,IX]=sort(A(:,1));
C(:,1)=B;
for j = 1:m
    C(j,2) = A(IX(j),2); 
end

Contact us