MAINT: small refactoring of matlab test

Just for neatness.
BUG: fix writing of logical arrays (gh-4022)

Fixes output type for logical arrays for MATLAB.

MATLAB apparently insists that logical arrays are in output type UINT8.
Merge pull request #4286 from matthew-brett/matlab-logical-matrix

MRG: fix matlab output type of logical array