Plot Price vs Time using Imported Excel Data
1 次查看(过去 30 天)
显示 更早的评论
Hello. I have an excel spreadsheet with two sheets that have two columns; one for price and another for date.
I was able to import the data into MATLAB using
nflx = importdata('nflx.xlsx');
I am trying to plot date on the X-axis and price on the Y-axis. I can load the data for the Y-axis, however attempting to load the data for the X-axis returns an error that cell cannot be converted to double.
How do I go about plotting the date on the X-axis?
0 个评论
回答(1 个)
Star Strider
2014-10-4
The difficult part is getting from your cell array of dates and MATLAB date numbers, because we don’t know what format they are in as you imported them.
2 个评论
Star Strider
2014-10-5
编辑:Star Strider
2014-10-5
I apologise for the delay.
That makes it simple:
DC = {'06/02/2014'; '06/07/2014'; '07/14/2014'};
DCn = datenum(DC, 'mm/dd/yyyy');
Just use datenum directly, then datetick on your x-axis.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calendar 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!