How can i find a specific member of an array?

3 ビュー (過去 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 Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by