Plot Price vs Time using Imported Excel Data
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Star Strider
on 4 Oct 2014
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 Comments
Star Strider
on 5 Oct 2014
Edited: Star Strider
on 5 Oct 2014
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.
See Also
Categories
Find more on Calendar in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!