date into double then back to date in loop
1 view (last 30 days)
Show older comments
Tatte Berklee
on 25 Nov 2019
Edited: Sean de Wolski
on 25 Nov 2019
I imported dates from an Excel file called original as below:
date =table2array(original(:,1));
datedouble= datenum(date);
I have a for-lop with a for loop variable j such that:
a(j+1,1)= datedouble(j+1,1);
My question: this for loop stores serial number of the date, and I want to conver this back to the dates. I tried datestr(datedouble(j+1,1)), but it says the dimension doesn't matach as it is some sort of 1x10 on the right hand side and left hand side is 1x1.
How can I resolve this?
Thanks!
0 Comments
Accepted Answer
Sean de Wolski
on 25 Nov 2019
Edited: Sean de Wolski
on 25 Nov 2019
You should really look at creating a datetime and using its various properties and methods instead of datenum or datestr.
Can you provide a small data set of what you have and what you want?
More Answers (0)
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!