How to extract year, month, day from character vectors?
5 views (last 30 days)
I have a character vector matrix (I think that's what it's called - it was obtained with cell2mat command applied to a *.csv file) which shows this when I open it (one column):
I would like to produce a numerical matrix X with as many rows but three columns (year, month, day, respectively). I've explored numerous options, to no avail. Any suggestions?
Kevin Holly on 11 Aug 2022
Edited: Kevin Holly on 11 Aug 2022
% I want to make you aware of Datetime arrays
% Here is how you can convert your data into a numerical matrix containing Year, Day, and Month columns
m = ;
for ii = 1:size(var,1)
m = [m;split(var(ii,:),"/")'];
X = str2double(m)