datetime error in 2025a version
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I have been using a program using 2019a version with no problem. After upgrading to 2025a, the datetime function is giving me problems. What has changed since 2019a?. Here is the code
Raw_Table.Date = datetime(My.Date, 'convertfrom', 'datestr', 'format', 'eee yyyy MMM dd');
where
My.Date
ans =
3×1 datetime array
2025-06-04
2025-06-05
2025-06-06
I get the following error:
Error using datetime (line 198)
Input data must be one numeric matrix when converting from a different date/time representation.
Thanks.
0 Commenti
Risposte (2)
Star Strider
il 7 Giu 2025
I may be missing something, however it appears that 'My.Date' is already a datetime array.
You do not need to do anything to it, however it is relatively easy to change its format.
Try smething like this --
My.Date = datetime([2025 06 04; 2025 06 05; 2025 06 06], Format='yyyy-MM-dd');
My.Date % Original
My.Date.Format='eee yyyy MMM dd';
My.Date % New Format
.
2 Commenti
Walter Roberson
il 7 Giu 2025
'convertfrom' 'datestr' is not a supported option
If you have date strings then you leave out the 'convertfrom' option.
But it does not appear that you have date strings. You have datetime objects. There are no versions of datetime() that accept datetime objects.
If you want to change the Format then just do
Raw_Table.Date = My.Date;
Raw_Table.Date.Format = 'eee yyyy MMM dd';
0 Commenti
Vedere anche
Categorie
Scopri di più su Calendar in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!