How to find out the set of Y values > 0 and corresponding X values?

6 views (last 30 days)
Hello,
I have a set of X values and corresponding Y values (n = 50). The X values are in the range [0:0.2:10]. The Y value corresponding to each X value has either +ve and -ve values. I would like to group all Y values which are +ve and also find out the corresponding X values.
I am unable to solve this issue. I tried using y(x(i))>0 but I got an error that the x(i) should be an integer.
Can anyone please help? Thank you.

Accepted Answer

Cris LaPierre
Cris LaPierre on 19 Mar 2020
I recommend first learning about indexing in chapter 5 of MATLAB Onramp, then moving to logical indexing in chapter 12 (task 4 in particular)

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!