Keep proper Indexing after sorting

조회 수: 1 (최근 30일)
M@lik Ali
M@lik Ali 2013년 2월 5일
편집: Stephen23 2017년 1월 21일
I have a matrix like below
fset(:,:,1) = rand(5,16);
fset(:,:,2) = rand(5,16);
fset(:,:,3) = zeros(5,16);
sorted_fset = sort(fset,3);
My problem is i have 999 small matrix in a big matrix like this means
fset(:,:,i),i=1,2,3,4....999
I represent the each image actually, now when i sort the matrix it sort for me but i cannot recognize the index of each image.
Like in above case
fset(:,:,3) will be fset(:,:,1)
but actually it was 3, so how i can recognize the image index after sorting in this case. if any confusion please comment

답변 (1개)

Jan
Jan 2013년 2월 5일
편집: Jan 2013년 2월 5일
[sorted_fset, index] = sort(fset, 3);
Matlab offers an exhaustive documentation which should be read in case of difficulties:
help sort
doc sort
  댓글 수: 2
M@lik Ali
M@lik Ali 2013년 2월 6일
I tried to read from matlab help
i try this one, but how i can get the corresponding index from this.
Jan
Jan 2013년 2월 6일
편집: Jan 2013년 2월 6일
I do not understand your comment. I've posted the method to get the sorting indices as 2nd output already. This method is explained in the mentioned help text also. So what are you looking for now?

댓글을 달려면 로그인하십시오.

카테고리

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