Hi,
I think you could try this approach, that is first convert the matrix into XYZ worksheet data using m2w x-function, and then use the "Discrete Frequency" tool (discfreqs x-function) to calculate the count on Z column (will be the RGB values presented in matrix)
So an example of the script would be:
// Need to activate the matrix book
m2w method:=xyz;
// Need to make sure the converted worksheet data is activated
discfreqs irng:=[%H]1!3
Kathy
Originlab