A small Java class library with three supporting MATLAB scripts for importing Content-MathML declarations (values, vectors, matrices and function handles (aka lambda expressions)) into the MATLAB workspace. The library supports exporting MATLAB data into Content- and Presentation-MathML.
% Initialize the Java Classpath for the MathML parser and check the installation
> MathMLInit;
% Import all contents of the GZIP-compressed MathML file test1.xml.gz into a
% cell array 'mml_defs':
> mml_defs = MathMLImport('test1.xml.gz');
% Import all MathML declarations of which name matches a regular expression
> mml_defs = MathMLImport('test2.xml', '[Mm]onkey[0-9A-Z]');
% Import all MathML declarations of a MathML file into the current workspace
> MathMLImport('test3.xml');
% Export variable A into the GZIP-compressed Content-MathML file test.xml.gz
> MathMLExport('test.xml.gz', 'c', 'A');
% Export variables A and B into the Presentation-MathML file test1.xml
> MathMLExport('test1.xml', 'p', 'A', 'B');
% Export variable A and B into the Content-MathML file test2.xml with embedded
% Presentation-MathML:
> MathMLExport('test2.xml', 'cp', 'A', 'B');
% Export variable A, B and C into the Presentation-MathML file test3.xml with
% embedded Content-MathML:
> MathMLExport('test3.xml', 'pc', 'A', 'B', 'C');
For Java source codes and more information see http://www.simtec.mb.uni-siegen.de/~weitzel/mathml.php |