把matlab中char变量处理过后变double

2024-10-30 11:33:32
推荐回答(1个)
回答(1):

S = '2014-10-23 17:56:23:123.5';
A = sscanf(S,'%4d-%2d-%2d %2d:%2d:%2d:%f');
dstr = sprintf('%4d%2d%2d%2d%2d%2d%5.1f',A);
num = str2num(dstr);

>> format long
>> num

num =

2.014102317562312e+016