MATLAB: How to filter data filtersubsample Dear all, I want to filter a matrix by its date vector. The datevector has the format: dd.mm.yyyy HH:MM:SS. I want to sum up all the data with the same month and year. How can I do that? Best Answer dateAsString = {'31.02.2013 11:22:33'; '31.05.2013 11:22:33'}dateAsVector = datevec(datestr, 'dd.mm.yyyy HH:MM:SS');yearAndMonth = 100 * dateAsVector(:, 1) + dateAsVector(:, 2);Now you get values like [201302, 201305] and summing can be done by accumarray directly. Related SolutionsMATLAB: Not expected results using datevec funcion Use this result = datevec(datestr('13/12/2013', 'dd/mm/yyyy HH:MM:SS'))datestr will set the missed time to 00:00:00 MATLAB: Datestr not working properly datestr(datenum(raw,'dd/mm/yyyy HH:MM:SS'), 'yyyy-mm-dd HH:MM:SS') Related QuestionSeparate year in dataDoes the datestr return weird resultMatlab imported excel time format changeDatetime problem of converting string
Best Answer