フィルターのクリア

Option 'stable' of the command unique?

3 ビュー (過去 30 日間)
MRC
MRC 2014 年 5 月 1 日
編集済み: Azzi Abdelmalek 2014 年 5 月 1 日
I have a matrix A ax1 and a vector B which is obtained as
B=sum( bsxfun(@eq, A, unique(A,'stable')') )'
E.g.
A=[5; 5; 3; 4; 4; 4];
B=[2;1;3];
The problem is that the option 'stable' is not recognized in my current version of Matlab. Do you have any idea about how I can replace this command?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 5 月 1 日
編集済み: Azzi Abdelmalek 2014 年 5 月 1 日
[a,idx]=unique(A)
[ii,ii]=sort(idx);
B=sum( bsxfun(@eq,A,a(ii)'))'

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by