Implement numPartitions() in Matlab

Fixes #2