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

2 views (last 30 days)
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.

Answers (1)

AA
AA on 8 Nov 2016
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

Categories

Find more on 2-D and 3-D Plots 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!