Borrar filtros
Borrar filtros

Plot data with date and time as the x axis

54 visualizaciones (últimos 30 días)
Amir Hosein Shokouhy
Amir Hosein Shokouhy el 4 de Mzo. de 2022
Editada: Cris LaPierre el 7 de Mzo. de 2022
Hello,
Can anyone help me plot this table data? I want to have the date and time as x - axis and the other variables as 6 differnent plots all in the same
figure.
Thanks,
Amir

Respuesta aceptada

Cris LaPierre
Cris LaPierre el 4 de Mzo. de 2022
Read the table in as a table using readtable. You will want to make sure column 1 is read in as a datetime. This 'should' happen automatically, but may depend on your version of MATLAB. Once in MATLAB, you can just plot using the datetime variable as your x input. As a datetime, it will automatically show date and time.
You can use xtickformat function to modify the display format of the datetime values.
See more info here.
  3 comentarios
Cris LaPierre
Cris LaPierre el 7 de Mzo. de 2022
Editada: Cris LaPierre el 7 de Mzo. de 2022
xlsx_name = 'C:\\Air Temperature\MQLoad (1).xlsx'
tab = readtable(xlsx_name);
stackedplot(tab,'XVariable','Var1')
If that doesn't work, please share your spreadsheet. You can attach it to your post using the paperclip icon.
Amir Hosein Shokouhy
Amir Hosein Shokouhy el 7 de Mzo. de 2022
It's working now, thank you!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dates and Time 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