Do a plot of the messages from 24 hours. Hour by Hour

1 Ansicht (letzte 30 Tage)
flashpode
flashpode am 28 Sep. 2021
Kommentiert: flashpode am 5 Okt. 2021
Hey, so I got a variable of duration that has de time of each message that goes from 00:00:00 to 23:59:59 and I want to make a plot that show me the amount of messages each hour. How could I do it? I made this but I got an error:
Hours_24 = (0:1:23)/24;
figure(1)
plot(Hours_24,Time_AIS1);
The error showed is:
Error using plot
Vectors must be the same length.
  5 Kommentare
Adam Danz
Adam Danz am 30 Sep. 2021
Your question suggests that you're trying to count the number of messages per hour but the code you shared suggests the problem is with plotting. So the question is not clear to me.
flashpode
flashpode am 5 Okt. 2021
well I've got Time_AIS1 that has the time of all the messages and I want a figure that shows me 24 columns where each column has the mesages that have the same Hour. In total there should be just 24 columns.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 30 Sep. 2021
Easy solution might be this, e.g.:
N = numel(Time_AIS1);
figure(1)
stem(1:N, Time_AIS1), xlabel('Hour'), ylabel('# of messages')

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by