added opts2struct submodule, mat-file writing, consolidated