drawing a vertical line in a plot if it is contained in the range

2 次查看(过去 30 天)
I have plotted a graph with the command line:
plot(x/y)
Variable x is a datetime array from 01-Sept-2015 00:00:00 till 5-Aug-2016 00:00:00. The distance between every x-value is 1 hour.
another datetime array z is defined as:
'01-Sep-2016 03:30:00'
'05-Oct-2016 02:30:00'
'01-Sep-2016 03:30:00'
'04-Aug-2016 03:30:00'
'05-Jul-2016 03:30:00'
I want the datetime array z to be drawn as red dotted vertical line in the plot graph if it is contained in the graph.

回答(1 个)

AA
AA 2016-11-8
the way to tackle this problem is to see if the above datetime array falls between the two dates (01-Sept-2015 00:00:00 till 5-Aug-2016 00:00:00), If it does then it should be displayed. How can I create that if condition? Once i have it displayed, it would be easy for me to plot on the chart

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by