add line in a plot
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello I have a figure with datetime in x- axis. I want to plot a vertical line but through code where is the exact point but i receive an error.
Any ideas how to do this?
댓글 수: 0
답변 (1개)
Steven Lord
2020년 7월 9일
First, plot some duration data.
y = (0:59);
x = duration(0, y, 1);
plot(x, y);
Now add a line at a specific value. Note that since I plotted with duration data on the X axis, when creating an xline I must create it at a duration value. If I tried something like xline(15) that wouldn't work.
xline(duration(0, 15, 0))
댓글 수: 2
madhan ravi
2020년 7월 9일
It was introduced in 2018b so if you’re using a prior release it won’t work.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!