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 Ansichten (letzte 30 Tage)
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?

Antworten (1)

KSSV
KSSV am 4 Nov. 2020
  1 Kommentar
Stephen23
Stephen23 am 24 Jun. 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)))

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by