Matlab 04 cond

This is an early pull request to resolve #708. There are a few FIXMES, but I think an early review might help.