简体   繁体   English

在Matlab中指出时间序列图中的日期

[英]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. 例如,时间范围从2000年6月1日到2000年8月1日,我有2000年5月5日,2000年6月6日,2000年8月10日,..我想显示其价格在情节上。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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