Notes on Code Translation to MATLAB(R) - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Code Generation Package : Matlab : CodeGeneration/General/MatlabDetails

Notes on Code Translation to MATLAB(R)


This help page describes details particular to code translation using the CodeGeneration[Matlab] function. For general information applicable to all the functions in the CodeGeneration package, see CodeGenerationDetails.



The MATLAB® code generated by CodeGeneration[Matlab] is valid for MATLAB® version 6.5 (R13).


In addition to the functions listed on the CodeGenerationDetails help page, the following Maple functions are recognized by CodeGeneration[Matlab]: cat, ceil, and floor.


Generally, math functions recognized by CodeGeneration[Matlab] are translated to native functions in the MATLAB® library. Additionally, the Maple symbol Pi is translated to the constant pi.


CodeGeneration[Matlab] translates printf statements to Print calls, but performs only limited analysis of the printf format string. Thus some formatting instructions (for example, precision for floats) are ignored in translation.


Although MATLAB® 6.5 allows longer identifiers, the translator renames identifiers longer than 31 characters to ensure compatibility with older versions of MATLAB®.


Any try/catch/finally clause in the original code is translated to a MATLAB® try/catch block; if more than one catch is present in the Maple input, the catch clause in the MATLAB® output will have a series of if statements, testing the value of lasterr.


The equivalent of a Maple module in MATLAB® is a directory.  Procedure module members correspond to .m files in this directory hierarchy.  All procedures are printed in sequence in the result of the MATLAB® command; comments indicate the appropriate place to put a piece of code in this directory hierarchy. Procedures that are exported module members are translated preceded by a comment modulename/procedurename.m:, while those that are local module members are translated preceded by a comment modulename/private/procedurename.m:.  Module local variables that are not procedures are declared as globals.

See Also






Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam