max value in a repetitive vector

1 回表示 (過去 30 日間)
Leilane Passos
Leilane Passos 2019 年 8 月 8 日
コメント済み: Leilane Passos 2019 年 8 月 8 日
Dear all,
I have a vector like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
And I need to find the max value in each "increasing piece". For exemple: I need to separate: 27, 36, 38
There is some function that Can I use for this?
Thanks,
Leilane

採用された回答

Adam
Adam 2019 年 8 月 8 日
編集済み: Adam 2019 年 8 月 8 日
maxes = [vec( diff( vec ) < 0 ), vec(end)];
works if it is as structured as your example always, where vec is your vector. If it isn't always an increasing set of sequences like that please give an example of a more general kind.
  1 件のコメント
Leilane Passos
Leilane Passos 2019 年 8 月 8 日
Hei Adam,
the:
maxes = [profs(diff(profs)<0); profs(end)], where profs is my vec works!
Thank you very much!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by