MATLAB: Using datenum with a structure field

datenumstructures

I'm working with a structure called data and there is a data.DATE field with values in format of 'yyyy-mm-dd HH:MM'.
When I try to replace the values in the structure field with
data.DATE = datenum(data.DATE, 'yyyy-mm-dd HH:MM');
I get an error of
Error using datenum
Too many input arguments.
This works fine for a cell array but not for the structure field. I guess I could split the data.DATE using regexp but was hoping to get this done in one line.
Any help / suggestions would be appreciated.

Best Answer

data.DATE = datenum({data.DATE}, 'yyyy-mm-dd HH:MM')