MATLAB Answers


Specifying range of data from a plot??

Asked by Clifford Shelton on 8 May 2012

This is my plot:


I understand the above code...but now I want to know the values of x when it has a specific relation to y.

How would I code that I want to know the values for x when y is equal or greater to a new variable n?

Something like: xSelect = get(lh,'xdata' if y>=n) ???? not sure how to code what I want.

Thanks for the help!



No products are associated with this question.

1 Answer

Answer by Rick Rosson
on 8 May 2012
 Accepted answer

   xSelect = x(y>=n);


so simple! Thanks! I'm such a beginner it's embarrasing!

Rick Rosson
on 8 May 2012

No need to be embarrassed. MATLAB is a very compact and powerful language; the initial learning curve can be challenging if you are used to working with traditional languages like C or Fortran.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!