How to bin data into intervals?
조회 수: 5 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
Star Strider
2018년 5월 12일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!