I have a 720 x 1 vector that I would like to modify to include all entries up to and including the first element greater than 100. So if the vector is
[0, 4, 8, 19, 101, 120]
the modified vector would be
[0, 4, 8, 19, 101].
How I would accomplish this? Thanks!

 採用された回答

Adam
Adam 2016 年 2 月 8 日

3 投票

a = [0, 4, 8, 19, 101, 120];
b = a( 1:find( a > 100, 1 ) );
This assumes the data is sorted which your example seems to imply.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeShifting and Sorting Matrices についてさらに検索

質問済み:

2016 年 2 月 8 日

回答済み:

2016 年 2 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by