How can i find a specific member of an array?

1 view (last 30 days)
Hello everybody,
I have an array full of calculated values. I need to find a fraction of it where it meets a specific condition and plot it.
How can i do that?
  2 Comments
Andrei Bobrov
Andrei Bobrov on 27 Feb 2018
Need an example of your array and condition
Yagmur Gencoglu
Yagmur Gencoglu on 27 Feb 2018
Okay, so for example i have an array like
A = [5 5 5 2 3 4 5 6 7 8 7 6 5]
and i only want to run my script for the part the values increase, in this case i want to create the array, B = [2 3 4 5 6 7 8]

Sign in to comment.

Accepted Answer

Birdman
Birdman on 27 Feb 2018
idx=find(diff(A)>0);
idx=[idx idx(end)+1];
B=A(idx)
  3 Comments
Birdman
Birdman on 27 Feb 2018
The indices are stored in idx array.
idx =
4 5 6 7 8 9 10

Sign in to comment.

More Answers (0)

Categories

Find more on Elementary Math 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!