04-07-2014 06:42 AM
i have a attached a Vi with a 2d array of integers. What im struggling to do is to count the occurence of numbers in the array and then then histogram this. For example if there were 10 occurences of the number 16 then the histogram will show 16 along the X axis and 10 on the Y axis.
i need to do this for every number on the array and plot the reuslts on one single array.
Any help would be great. i have looked on some of the examples but they are all dealing wioth 1d arrays.
Dave
04-07-2014 06:53 AM
04-07-2014 08:18 AM
a little array reshaping goes a long way
04-07-2014 08:22 AM
04-07-2014 08:43 AM
No trouble at all Gerd. I figured you had a reason to avoid the built-in function.
04-07-2014 09:44 AM - edited 04-07-2014 09:45 AM
Just to throw in another solution (specific to this problem; modifications needed if bin size changes). I like this trick of counting the number of elements equal to a number in an array. It may not be most efficient, but it's clean and I use it quite often so it's a good one to know.