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