Plot Date from Excel Table
Show older comments
Hi Everyone, my first post here. This should be a easy but it's driving me crazy!. I have tried finding the answer in the documentation and on the forums but I cannot, apologies, I know this will be obvious once I know.
I have an Excel file with data formatted as such:
a b
1 2019-05-23 $100.30
2 2019-05-24 $100.40
3 2019-05-25 $100.50
4 2019-05-26 $100.60
I imported the file and it shows in workspace as DatePrice. I have tried two methods to plot this and failed:
1) >> plot (DatePrice(1:4,1),DatePrice(1:4,2))
Error using tabular/plot
Too many input arguments.
2)
>> date = DatePrice(1:4,1) --------- this returns the dates properly
>> price = DatePrice(1:4,2) ----------- this returns the prices properly
>> plot (date,price) -------------I get this error
Error using tabular/plot
Too many input arguments.
PS: I have searched the forums and I know I have to do something like datenum(xxxxxxxxx) but I'm not sure what. I tried to no avail:
>> dateToNumber = datenum(DatePrice(1:4,),'yyyy-mm-dd')
Can anyone kindly help?
1 Comment
dpb
on 6 Aug 2019
Show the code used to import the data and what does
whos DatePrice date price
show after you do the above?
OH--Also, maybe you've inadvertentedly aliased the plot() function. Show us also what
which -all plot
returns.
It can't hurt anything, so instead of waiting for us,
clear plot
and then try again and see if symptoms go away. If so, that's what happened; you accidentally overwrote the plot name.
Answers (0)
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!