How can i find a specific member of an array?

조회 수: 1 (최근 30일)
Yagmur Gencoglu
Yagmur Gencoglu 2018년 2월 27일
댓글: Yagmur Gencoglu 2018년 2월 27일
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
Andrei Bobrov
Andrei Bobrov 2018년 2월 27일
Need an example of your array and condition
Yagmur Gencoglu
Yagmur Gencoglu 2018년 2월 27일
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]

댓글을 달려면 로그인하십시오.

채택된 답변

Birdman
Birdman 2018년 2월 27일
idx=find(diff(A)>0);
idx=[idx idx(end)+1];
B=A(idx)
  댓글 수: 3
Birdman
Birdman 2018년 2월 27일
The indices are stored in idx array.
idx =
4 5 6 7 8 9 10
Yagmur Gencoglu
Yagmur Gencoglu 2018년 2월 27일
Oh, now i see. Many thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by