Plot Date from Excel Table

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 件のコメント

dpb
dpb 2019 年 8 月 6 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTime Series Objects についてさらに検索

質問済み:

2019 年 8 月 6 日

コメント済み:

dpb
2019 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by