display dates and times of imported .csv file in Date Picker Menus in App Designer
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
William Collants
el 27 de Mayo de 2020
Respondida: Cris LaPierre
el 28 de Mayo de 2020
In Matlab App Designer, I'm building an App which imports a .csv.
The First Column of that imported Table contains Dates in the form yyyy.MM.dd.
The 2nd Column contains Times in the form hh:mm:ss
I've added 4 'Date-Pickers' to the App.
I want 1 to display the 'earliest Date', one the 'earliest Time',
one the 'latest' Date, and the last the 'latest Time'.
And I'm having trouble making that Happen.
So basically have one read the 1st Row of the Date Column, one the last Row of the Date Column,
one the 1st Row of the Time Column, one the last Row of the Time Column.
(Unless Matlab/ App Designer has a built in function to read the earliest/latest date/time automatically without having to refer to specific rows/columns)
Is there, too, the capability to add in a failsafe, incase the imported .csv contains no Date-Column, and/or no Time-Column, to still be able to Run the App without it crashing? If there's a Date Column, but no Time-Column, or vice versa, or neither, the corresponding fields are simply left blank and non-interactive or display
"your imported csv does not contain date/time values, Stupid!"
Kind Regards,
Tim
0 comentarios
Respuesta aceptada
Cris LaPierre
el 28 de Mayo de 2020
A datetime is, by definition, a date + a time. I suggest reading in the date and time as strings, then combining them and then converting the resulting string into a datetime.
That way, you can just use min and max to find the earliest and latest datetimes in the data.
It's unclear what you want the datepicker to do. Do you want the user to select a date and time, or do you only want to use it to display back to the user the datetimes? If the later, you could just display the datetime in a text box.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!