필터 지우기
필터 지우기

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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by