Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Obtain a vertical line at the point clicked to show selected segments

Subject: Obtain a vertical line at the point clicked to show selected segments

From: Mohammed Islam

Date: 22 May, 2009 02:12:01

Message: 1 of 2

Hi all,

I have been trying to find out a way to draw a vertical line after I click on certain area on a plot to distinguish between selected segments on a timeseries without much success. Could anyone please help me with this or know where'd I get resrouce regarding this? The purpose of this is to make sure when I select segment from a timeseries, I don't select a portion twice or they dont overlap. I highly appreiciate your time and effort. Have a good one.

Subject: Obtain a vertical line at the point clicked to show selected segments

From: Sadik

Date: 22 May, 2009 16:09:06

Message: 2 of 2

Hello Mohammed,

If you have your plot ready, you could do the following. But IMPORTANT: You need to press enter after you make a SINGLE selection. If you click more than once, you may have trouble. If you would like to plot multiple vertical lines, then you had better put this in a for loop or the like, and each time make a single selection and press enter. This code draws a vertical red line.

[x,y] = ginput; %
yLims = get(gca,'YLim');
hold on
line([x,x],yLims,'Color','red')





<gv51lh$k6s$1@fred.mathworks.com>...
> Hi all,
>
> I have been trying to find out a way to draw a vertical line after I click on certain area on a plot to distinguish between selected segments on a timeseries without much success. Could anyone please help me with this or know where'd I get resrouce regarding this? The purpose of this is to make sure when I select segment from a timeseries, I don't select a portion twice or they dont overlap. I highly appreiciate your time and effort. Have a good one.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us