Borrar filtros
Borrar filtros

Plot time data

12 visualizaciones (últimos 30 días)
Jisha
Jisha el 23 de Feb. de 2012
I have time in a matrix and some data, how do I plot it..
a=['17:00';'17:30' ;'18:00'; '18:30' ;'19:00'];
b=[b=[2;4;5;3;1];
Error
plot(a,b)
Error using plot
Invalid first data argument
How can I plot it and show the time on Xaxis?

Respuesta aceptada

Thomas
Thomas el 23 de Feb. de 2012
You are getting an error because a is a string
You can use the following
c=datenum(a, 'HH:MM'); % convert date into a number to plot it
plot(c,b); % plot the data,
hold on;
datetick('x','HH:MM') % give the a xaxis time label ticks..

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by