Trouble pivoting large table using unstack function
이전 댓글 표시
I have a large table (6307840x42) that I need to pivot. To scale down the problem, let's assume the table looks something like this:
Measurement Value DUT # DUT Barcode
___________ _____ _______ ___________
Temperature 50 1 ABC123
Humidity 15 1 ABC123
Voltage 1.2 1 ABC123
Temperature 52 2 DEF456
Humidity 12 2 DEF456
Voltage 1.1 2 DEF456
Temperature 48 3 GHI789
Humidity 17 3 GHI789
Voltage 0.8 3 GHI789
I want to pivot the above table such that the values in the Measurement column become new column titles which contain the data stored in the Value column:
Temperature Humidity Voltage DUT # DUT Barcode
___________ ________ _______ _____ ___________
50 15 1.2 1 ABC123
52 12 1.1 2 DEF456
48 17 0.8 3 GHI789
I have tried using the unstack function to achieve this, but the result spits out a 0x62 sized table containing only the pivoted variable names, but no data. My code looks something like this:
ds = datastore('myTable.csv')
myTable = readall(ds);
myPivotedTable = unstack(myTable,'Value','Measurement');
Am I using the unstack function incorrectly? Am I approaching the problem compeltely the wrong way? Any help would be greatly appreciated.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!