histcount does not work as excepted
Show older comments
Dear all,
I want to calculate the position of double (or multiple) values inside a list. I found an answer in this forum, however I have stumbled across a problem with histcount. Is the following behaviour of histcount as excepted. The function histc works perfectly.
a=[1 2 3 4];
b=[1 1 2 2 3 3 4 4];
[c,d]=histcounts(b,a);
multi=sum(b==d(c>=2)')>=1
% 1 1 1 1 1 1 0 0
[c,~]=histc(b,a);
multi=sum(b==a(c>=2)')>=1
% 1 1 1 1 1 1 1 1
The algorithm is based on:
I use Matlab 2018a on a Ubuntu 20.04 LTS system.
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!