简体   繁体   中英

point out a date in time series plot in matlab

I have a time series of daily prices, I plotted it and I have some days that I would like to highlight with a little circle on the curve of price on these days. For example, the time series spans from 1-jun-2000 to 1-oct-2000 and I have days 5-jun-2000, 6-jun-2000, 10-aug-2000,.. whose prices I would like to show on the plot. The problem is that the series of days I would like to point out are on a different vector and I do not get to find them in the series of all days. I think I should at first find the indexes of these particular dates in the complete series of dates and than use this index to point out the corresponding prices to highlight on the curve. Any help?

thank you in advance

John

Never mind, I have just got it:

[tf, index] = ismember(Date, tofindDate) % get the position in series 
plot(Date(index),p(index),'ro') % highlight the desired point

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM