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 Exchange에서 Geometric 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