I have a large table (6307840×42) 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 ABC123Humidity 15 1 ABC123Voltage 1.2 1 ABC123Temperature 52 2 DEF456Humidity 12 2 DEF456Voltage 1.1 2 DEF456Temperature 48 3 GHI789Humidity 17 3 GHI789Voltage 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 ABC12352 12 1.1 2 DEF45648 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.