This function takes a variable name, collects its contents from the base workspace and outputs (to the clipboard and the variable OutputCharMatrix) the m-code necessary for MATLAB to re-create the variable, including the variable name.
This is useful for including matrices of constants in m-files.
Accepts full or sparse matrices of real or complex numeric values.
For small 2D matrices, try mat2str instead.
MATLAB 7 (R14)
Tested on a windows PC, probably works on UNIX too.