Implemented matrix workspace output. Refs #8685.

Also added several unit tests for the new feature.