Problem with plotting dates

2 ビュー (過去 30 日間)
Gin
Gin 2019 年 8 月 19 日
回答済み: dpb 2019 年 8 月 19 日
I have a data with 276 dates (for example: Sep 14, 2011) and corresponding numbers to each of them in an excel file. How can I plot a scatter graph with dates on x axis and numbers on y? What code should I use?

回答 (1 件)

dpb
dpb 2019 年 8 月 19 日
Use readtable and maybe detectImportOptions first. Then, plot is datetime-aware, so you just call plot with the two variables...
t=readtable('yourfile.xlsx')
plot(t.Date,t.YData) % presuming your dependent variable has name of YData
You will use whatever are the variable names from the Excel sheet that are imported in place of the ones I made up, of course.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by