qsort

버전 1.0.0 (2.75 KB) 작성자: Bruno Luong
Sort data with user-supplied comparison function
다운로드 수: 5
업데이트 날짜: 2022/3/31

라이선스 보기

Some examples of usage:
% Sort numerical array in descending order
A=rand(1,100000); tic; [As,is]=qsort(A, @(x,y) y-x); toc
% Sort strings
s = string(randi(200,1,20))
ss = qsort(s, @(x,y) double(x)-double(y))
% Sort structures
s = struct('name',{'smith' 'jackson' 'anna'},'yearofbirth', {40 70 60});
ss = qsort(s, @(x,y) x.yearofbirth-y.yearofbirth);
{ss.name} % returns {'smith'} {'anna'} {'jackson'}
[ss.yearofbirth] % returns 40 60 70
% Sort cell array
c = num2cell(struct('name',{'smith' 'jackson' 'anna'},'yearofbirth', {40 70 60}));
cs = qsort(c, @(x,y) x{1}.yearofbirth-y{1}.yearofbirth);
cs{:}

인용 양식

Bruno Luong (2024). qsort (https://www.mathworks.com/matlabcentral/fileexchange/109104-qsort), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0