Generate class frequency distribution
M = GENCLASS(N,P)
Generates a class frequency distribution M of N (scalar) samples over a set of classes with prior probabilities given by the vector P. The numbers of elements in P determines the number of classes and thereby the number of elements in M. P should be such that SUM(P) = 1. If N is a vector with length C, then M=N is returned. This transparent behavior is implemented to avoid tests in other routines.
Note that this is a random process, so M = GENCLASS(100,[0.5, 0.5]) may result in M = [45 55].
This routines is used in various data generation routines like GENDATH to determine the distribution of the objects over the classes.