Fix errors in Matlab implementation of numPartitions()