MATLAB: HELP I need to convert Charater to numbers….

char struct

Hey, maybe someone can help me with a way to convert from chart to numbers in a matrix like this: a = '2014-06-20T00:00:00-0500' and conver to a = [2014 06 20 00 00 00 0500], please if someone know some codes … help me please… or I need instructions that can help…. Thank you

Best Answer

See if this does what you want:
astr = '2014-06-20T00:00:00-0500';
avct = cellfun(@str2num, regexp(astr, '\d+', 'match'))
avct =
2014 6 20 0 0 0 500