converting dates from excel file for plotting

Hi there,
I'm here to ask for your help. I have the mac version of Matlab. I need to import a file excel with three type of data: date, time and price of a stock. I'm currently importing them by using the command like this: [date]=xlsread(filename, 'B2:B10485'); and I obtain an array type double 1048576x1 that is ok.
The problem is plotting the prices with the correspond year, so that I can identify easily the pattern of the prices across years. How can I do?
Just for example, I obtain numbers like 35067, which converted with x2mdate is 729027 and then with datestr to 03-Jan-1996.
Thank you very much. I hope my problem is clear.

Answers (1)

Use the x2mdate() results as your x axis. Then use
datetick('x','YYYY')
if you want there to be x tick labels at each year.

Categories

Find more on Language Fundamentals 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!