How can I sort Images ?

2 ビュー (過去 30 日間)
Edmond Geraud
Edmond Geraud 2015 年 5 月 1 日
編集済み: Guillaume 2015 年 5 月 1 日
I have a vector
norma=[1.087,0.047,0,0.35]
And I have several frames from a video. Ex.
pill(:,:,:,48);
pill(:,:,:,49);
pill(:,:,:,50);
pill(:,:,:,51);
What I want is to "attach" each frame to each element from norma vector, and then sort the images, by sorting norma vector in ascending way.
How can I do this ?
Thanks in advance !!

採用された回答

Guillaume
Guillaume 2015 年 5 月 1 日
編集済み: Guillaume 2015 年 5 月 1 日
Use the second return value of sort to reorder the 4th dimension of your pill array. In your particular example:
norma = [1.087,0.047,0,0.35];
[sortednorma, order] = sort(norma);
pill(:, :, :, 48:51) = pill(:, :, :, 47 + order);
%obviously, if norma is the same length as the 4th dimension of pill, it's simply:
%pill = pill(:, :, :, order);
edit: fixed a typo
  1 件のコメント
Edmond Geraud
Edmond Geraud 2015 年 5 月 1 日
Thank you !

サインインしてコメントする。

その他の回答 (1 件)

Thomas Koelen
Thomas Koelen 2015 年 5 月 1 日
norma=[1.087,0.047,0.35]
n=norma'
a=magic(3)
b=cat(2,a,n)
c=sortrows(b,4)
c(:,4)=[];
Should do the job! ofcourse magic will be your video here.
  1 件のコメント
Edmond Geraud
Edmond Geraud 2015 年 5 月 1 日
Thank you !

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by