Hi! I have a vector that I want to group into intervals so that the values are greater than 50 but less than 500 apart in each interval and omit numbers that do not fall in this range. For example if I had vector [5 50 400 1000 1200] I would want to separate this into [50 400] and [1000 1200]. How can I do this? Thank you!

 採用された回答

Star Strider
Star Strider 2018 年 5 月 12 日

0 投票

I would do this:
D = randi(1300, 1, 250); % Create Data
hc = histcounts(D, [50 400 1000 1200]); % Ask ‘histcounts’
Result = hc([1 3]); % Return Requested Intervals

2 件のコメント

Natalie St. John
Natalie St. John 2018 年 5 月 13 日
thank you!
Star Strider
Star Strider 2018 年 5 月 13 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by