Organizing data into a matrix, Generating a matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I need little help with data manipulation. I have a 250x3 cell that i have imported from excel file. Data looks like:
A B C
100 5 1.0325
100 10 1.5648
100 15 1.1456
200 5 1.8986
200 15 1.6545
300 10 1.9879
So I want to convert this data into a matrix with column A data as X axis and Column B data in Y axis. Something like as follows:
100 200 300 ... so on
5 1.0325 1.8986 0
10 1.5648 0 1.9879
15 1.1456 1.6545 0
.
.
.
so on
This is just an example and actually i have huge amount of data to deal with.
Any idea, help, tips or suggestions are appreciated.
Thanks in advance. //Arsalan
댓글 수: 0
채택된 답변
Andrei Bobrov
2011년 10월 31일
A = [100 5 1.0325
100 10 1.5648
100 15 1.1456
200 5 1.8986
200 15 1.6545
300 10 1.9879]
[a1 j1 j1] = unique(A(:,1))
[a2 j2 j2] = unique(A(:,2))
out = [0,a1';a2 accumarray([j2 j1 ],A(:,3),[numel(a2),numel(a1)])]
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!