Counting number of elements in an interval across a range?

조회 수: 4 (최근 30일)
Bret Valenzuela
Bret Valenzuela 2016년 5월 28일
댓글: Star Strider 2016년 5월 28일
Hello, I need to make a skewness plot using data from a large column of numbers. The project lead wants to find the number of terms within an interval of 200 x data points. I am looking for a code that will tell me the number of terms in each interval 200 times until the end of the x values. In short I need 200 terms each with the # of elements in that interval. I appreciate any advice on this topic!

답변 (2개)

Roger Stafford
Roger Stafford 2016년 5월 28일
This is precisely what Matlab’s ‘histc’ (or ‘histcounts’) function is designed to do. Read about it at the site:
http://www.mathworks.com/help/matlab/ref/histc.html

Star Strider
Star Strider 2016년 5월 28일
I have no idea what question you’re actually asking.
Three functions come to mind that could work: sort, prctile, and reshape.
Please clarify what it is you want from your data.
  댓글 수: 2
Bret Valenzuela
Bret Valenzuela 2016년 5월 28일
I have imported columns of data from excel ranging from 332x1 to 1559x1 in size. I need to apply a code that will count the number of terms in an interval from the start of the column to the end. Meaning I have a range of x values (usually 0:.15:30) and I need to count the number of #'s in each step. then I can use that data for a skewness function. I don't have any code right now but I can attempt to go into more detail if that is needed. Thank you for the quick response!
Star Strider
Star Strider 2016년 5월 28일
My pleasure!
There are a number of histogram functions in MATLAB that will do exactly what you want. Their names vary depending on your MATLAB version and what you want them to do.
In the Command Window, type:
doc hist
to begin your search.
To plot the results, also see the bar function.

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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by