Hey everyone.! I have some data in this form
'Mary' [ 37]
'Lisa' [ 18]
'George' [ 20]
'Nick' [ 49]
'Mary' [ 24]
'George' [ 4]
'Lisa' [ 36]
(random names with random sequence)and I want to have this
'Mary' [ 61]
'Lisa' [ 54]
'George' [ 24]
'Nick' [ 49]
(not necessarily in this order) Any good ideas? Thank you all..

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 17 日

0 投票

v={'Mary' [ 37]
'Lisa' [ 18]
'George' [ 20]
'Nick' [ 49]
'Mary' [ 24]
'George' [ 4]
'Lisa' [ 36]}
[a,b,c]=unique(v(:,1),'stable')
n=accumarray(c,[v{:,2}]')
out=[a num2cell(n)]

1 件のコメント

Andreas
Andreas 2013 年 11 月 17 日
aaaaamazing. thank you Azzi for your precise and quick answer.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGeometric Transformation and Image Registration についてさらに検索

質問済み:

2013 年 11 月 17 日

コメント済み:

2013 年 11 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by