0
'10004_1'     '01:27:29'                '27'         'Uncertainty'                   ''
'10004_2'     '02:03:10'                '3:29'       'Neutral'                       ''
'10004_3'     '01:01:01'                '5:31'       'Neutral'                       ''
'10004_4'     '01:10:02'                '1:16'       'Neutral'                       ''

我有上面的示例数据,这些“%%:%%:%%”格式的数据需要按以下方式处理。

i.e. 01:27:29 => (((1*60+27)*60)+29)*30 which would be a numeric value. 

我尝试使用cellfun,在cellfun中使用的函数会用':'分割字符串,并进行计算。也许还有一些其他的方式。Matlab的新手,真的不知道。同时,我将尝试该功能,看看是否可行。请随时让我知道您的想法或示例代码。欣赏这一点。

4

1 回答 1

2
text = '01:23:12';
nums = textscan(text, '%d:%d:%d');
rst  = (((nums{1} * 60 + nums{2}) * 60) + nums{3}) * 30;
于 2013-09-24T20:25:35.177 回答