Ethan and Richard,
Well over a decade late I have refactored your PetscViewerBinaryMatlabOpen()
code to embed it in the standard PETSc binary viewer so it doesn't introduce
nonstandard paradigms into PETSc. Could you please test it out in petsc-dev to
find all the bugs I have introduced?
To get the effect you just call PetscViewerBinaryOpen() followed by
PetscViewerSetFormat(viewer,PETSC_FORMAT_BINARY_MATLAB); the names of the
variables are obtained by the names of the PETSc objects which may be set with
PetscObjectSetName().
Thanks
Barry