Create a results matrix/table
이전 댓글 표시
I'd like to combine various types of data into a single matrix. The headers would be 'Date', 'File', 'Speed', 'Distance'.
Each time I process the data I have four data sets. Here's an example of an output:
Date1 = 'March 3 2015'
File1 = 'r8mar3speed1'
Speed1 = 44
Distance = 59
Date2 = 'March 3 2015'
File2 = 'r8mar3speed2'
Speed2 = 32
Distance2 = 63
Date3 = 'March 3 2015'
File3 = 'r8mar3speed3'
Speed3 = 34
Distance3 = 56
Date4 = 'March 3 2015'
File4 = 'r8mar3speed4'
Speed4 = 32
Distance4 = 58
I'd like to combine all of these into a single matrix with the dates in column 1, filenames in column 2, speeds in column3, and distances in column 4 but I'm having trouble because some data are strings.
답변 (1개)
Geoff Hayes
2015년 3월 14일
T = table({Date1; Date2; Date3; Date4}, ...
{File1; File2; File3; File4}, ...
[Speed1; Speed2; Speed3; Speed4], ...
[Distance; Distance2; Distance3; Distance4], ...
'VariableNames', {'Date','File','Speed','Distance'})
Or use a cell array since you have different data types.
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!