I have separate column vectors of dd, mm, yyyy, HH and MM, how do I combine them into the format dd-mm-yyyy HH:MM to plot on the x axis

2 vues (au cours des 30 derniers jours)
I have the variables day, month, year, hour and minute - all column vectors.
How do I combine these into the dd-mm-yyyy HH:MM format so I can plot this on the x-axis of a graph?

Réponses (1)

KSSV
KSSV le 4 Nov 2020
  1 commentaire
Stephen23
Stephen23 le 24 Juin 2024
For example:
Xye = [2023;2024;2024];
Xmo = [12;01;01];
Xda = [31;01;03];
Xho = [02;23;07];
Xmi = [59;01;23];
D = datetime(Xye,Xmo,Xda,Xho,Xmi,0)
D = 3x1 datetime array
31-Dec-2023 02:59:00 01-Jan-2024 23:01:00 03-Jan-2024 07:23:00
plot(D,rand(size(D)))

Connectez-vous pour commenter.

Catégories

En savoir plus sur Calendar dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by