フィルターのクリア

convert string to number

3 ビュー (過去 30 日間)
Mate 2u
Mate 2u 2012 年 2 月 21 日
編集済み: Cedric 2013 年 10 月 19 日
Hi I have a string array as following:
'15:30:00'
'15:30:01'
'15:30:02'
'15:30:03'
'15:30:04'
'15:30:05'
'15:30:06'
ETC.....
I want the out put to be like 153000
153001
153002
153003
etc,
any help

採用された回答

Jan
Jan 2012 年 2 月 21 日
S = {'15:30:00'; '15:30:01'; '15:30:02'};
S = strrep(S, ':', '');
D = sscanf(sprintf('%s ', S{:}), '%d');
  1 件のコメント
Andrei Bobrov
Andrei Bobrov 2012 年 2 月 21 日
D = str2num(datestr(S,'HHMMSS'))

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

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 2 月 21 日
s = '15:30:00';
sn = str2double(s(isstrprop(s,'digit')))

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by