Many small changes to get a clean bill of health in the Matlab code analyser

Most of these changes are

* Semicolons to suppress output
* Pre-allocation of variables
* Rewording of logicals from | to ||
* strcmp instead of == for string comparison