How can I count the number of data in this particular figure?

조회 수: 1 (최근 30일)
smo
smo 2016년 4월 14일
댓글: Star Strider 2016년 4월 15일
Hi, Can someone please help me with this: I want to count the number of data in each of the 5'groups' as shown in the figure. Hoping to get a result as a vector with 1row 5 column and each number in the column shows the number of counts.
What's the best way of doing it?
---------------
Edit info: I have a set of signal data, which gives me a plot with 5dips. I am trying to set a threshold (say, -6E-3), and count the number of data at each of these dips.
I now get the index of these data and they looks something like this:
[620, 621,...,670,671,2323, 2324,...,2374,4023,....,4068, (etc)], and I was trying to plot them to show in here, that the data are distributed in 5 'area', and I am hoping to count the number of data in each of these area. -------------------------------------
Thank you.

채택된 답변

Star Strider
Star Strider 2016년 4월 14일
편집: Star Strider 2016년 4월 14일
You obviously have the original data or you could not have plotted that figure. I would use the histcounts2 function:
y = randi([0 9], 5, 30);
x = repmat([1:5]', 1, size(y,2));
figure(1)
plot(x, y, 'x')
axis([0 6 ylim])
[N, xe, ye] = histcounts2(x,y);
  댓글 수: 2
smo
smo 2016년 4월 15일
편집: smo 2016년 4월 15일
sorry I didnt explain myself more clear.
I have a set of signal data, which gives me a plot with 5dips. I am trying to set a threshold (say, -6E-3), and count the number of data at each of these dips.
I now get the index of these data and they looks something like this: [620, 621,...,670,671,2323, 2324,...,2374,4023,....,4068, (etc)], and I was trying to plot them to show in here, that the data are distributed in 5 'area', and I am hoping to count the number of data in each of these area. ===========================
Thank you for the hint!! I used 'histcounts' and it works!
Star Strider
Star Strider 2016년 4월 15일
My pleasure!
I had to simulate your data, so it was something of a guess on my part as to what the best approach would be.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by