How do I remove leading digits in a .CSV

So I have a huge amount of data to process (in .csv form) and a product of the collection the time stamps come in the form of:
001 00:05:04:058299394
Matlab is not seeing this as a time or anything due to the 001 (day) mark on the front side of the stamp.
Is there a script or code that exists to remove this and get rid of the error that matlab is throwing.

回答 (2 件)

dpb
dpb 2016 年 4 月 5 日

0 投票

If you have recent release which includes the datetime class, then read it as a date with the D format descriptor. "DDD" is the day-of-year field descriptor for 3-digit DOY. See
<datetime-properties Format> and links therefrom...
If not, post back with a short sample of the data file...
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 5 日

0 投票

s='001 00:05:04:058299394'
a=regexp(s,'(?<=\s+)\S+','match')

2 件のコメント

Matthew Engquist
Matthew Engquist 2016 年 4 月 7 日
編集済み: Azzi Abdelmalek 2016 年 4 月 8 日
so that works perfect! How would I do this for a column of data?
Here is what I am looking at:
001 00:10:26.298066
001 00:10:26.303391
001 00:10:26.308716
001 00:10:26.314041
001 00:10:26.319365
001 00:10:26.324690
001 00:10:26.330015
001 00:10:26.335340
001 00:10:26.340665
001 00:10:26.345990
001 00:10:26.351315
001 00:10:26.356640
001 00:10:26.361965
001 00:10:26.367289
001 00:10:26.372614
001 00:10:26.377939
001 00:10:26.383264
001 00:10:26.388589
001 00:10:26.393914
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 8 日
v={'001 00:10:26.298066'
'001 00:10:26.303391'
'001 00:10:26.308716'
'001 00:10:26.314041'}
a= regexp(v,'(?<=\s+)\S+','match');
out=[a{:}]'

サインインしてコメントする。

カテゴリ

タグ

質問済み:

2016 年 4 月 5 日

コメント済み:

2016 年 4 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by