Set a bin to count the data points for certain conditions

조회 수: 1 (최근 30일)
Laura
Laura 2013년 7월 17일
Hi there,
I want to count the number of data values that are in this conditions
if it satisfies both conditions then count it
if dist>= R & dist<=(R+dr)
and
if dist1>= R1 & dist1<=(R1+dr1)
Please help.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 17일
This is not clear
Jos (10584)
Jos (10584) 2013년 7월 17일
I suggest you give a (very) small example!
dist = [...]
dist1 = [...]
R = ...
etc.
ExpectedOutcome is: ...

댓글을 달려면 로그인하십시오.

채택된 답변

Sean de Wolski
Sean de Wolski 2013년 7월 17일
idx = (dist >= R) & (dist<=(R+dr)) & (dist1>=R1) & (dist1<=(R1+dr1)); %all that meet criteria
count == nnz(idx); %how many of these were true?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by