changing the format of a cell matrix

3 ビュー (過去 30 日間)
ektor
ektor 2019 年 1 月 29 日
回答済み: Walter Roberson 2019 年 1 月 29 日
Dear all,
I have this cell matrix 'data', where as you can see below the element for example 8:00:06 is the hour-minute-second.
data(1:3,:)
ans =
3×1 cell array
{'01 8:00:06 29.0000 1000'}
{'01 8:00:06 29.1000 200'}
{'01 8:02:08 29.0700 1000'}
Now I want to convert the above matrix to the folowing format
01 8 00 06 29.000 1000
01 8 00 06 29.1000 200
01 8 02 08 29.0700 1000
Is there any way to do that in matlab? Can I have a sample code?
Many thanks

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 29 日
cell2mat(cellfun(@(S) sscanf(S, '%f %f:%f:%f %f %f').',data,'uniform', 0))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by