How to process a string in a cell with MatLab -


'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 have above sample data , these "%%:%%:%%" format data needed processed in following way.

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

i tried using cellfun, , function used in cellfun split string ':', , make calculation. maybe other ways. newbie matlab, no clue. in meantime, try function see if work. please feel free let me know thoughts or sample codes. appreciate this.

text = '01:23:12'; nums = textscan(text, '%d:%d:%d'); rst  = (((nums{1} * 60 + nums{2}) * 60) + nums{3}) * 30; 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -