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
Geoff Hayes 2015년 3월 14일

0 개 추천

Stanley - consider using a table as
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.

댓글 수: 1

Stanley Kubrick
Stanley Kubrick 2015년 3월 17일
Unfortunately my version of Matlab doesn't have the table() function. I'm on R2013a, I believe it was implemented in R2013b.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2015년 3월 13일

댓글:

2015년 3월 17일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by