Need to group data and transpose portion of the table
조회 수: 3 (최근 30일)
이전 댓글 표시
I have a dataset that includes test data for different circuit cards. The original table of data (T1) is orgaized by Serial Number (SN) of the board and a timestamp (Start_Time) that the circuit card started its test procedure. The two remaining columns are the name of the individual test steps (Test_Name) and the data values recoreded at each of those test steps (Data).
Since there are multiple tests run for each serial number, the data in SN and Start_Time are duplicated multiple times with the only new information being the Test_Name and Data. You can assume that the Test_Name values are the same for each circuit card serial number (i.e. we can treat them as categorical varriables).
I'm looking to do two things:
1) Goup the data by SN and Start_Time so they are not duplicated for each test
2) append the partially transposed data in Test_Name and Data so that each Test_Name becomes a new variable or column with the appropriate Data value beneath it.
Here's a sample of the original data table (T1):
SN = [1; 1; 1; 2; 2; 2];
Start_Time = [10; 10; 10; 20; 20; 20];
Test_Name = {'test_1'; 'test_2'; 'test_3'; 'test_1'; 'test_2'; 'test_3'};
Data = [23; 15; 23; 1; 44; 77];
T1 = table(SN, Start_Time, Test_Name, Data,'VariableNames',{'SN' 'Start_Time' 'Test_Name' 'Data'});
Here's what I'd like the data to look like after it's processed (T2):
댓글 수: 0
답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!