How do I translate code from Maple to MATLAB?

29 vues (au cours des 30 derniers jours)
Samy
Samy le 19 Juil 2013
Commenté : Walter Roberson le 29 Jan 2023
I would like to know if it was possible (and easy) to translate a whole worksheet of code from maple to MATLAB (and possibly the functions that are called inside the Maple code).
Thank you
  2 commentaires
Muthu Annamalai
Muthu Annamalai le 19 Juil 2013
Could you be more specific? There is nothing that is not possible with enough time, effort, given MATLAB is a general purpose language as well.
Larry Gulliver
Larry Gulliver le 20 Jan 2021
I just tried cutting and pasting directly from Maple v2020.1 to Matlab 2015b editor and it was almost perfect. Mind you I had to piecemeal it by function to make sure it worked and it was a fairly simple code without derivatives, matrices or logical arguments. I did have to tweak some of the multiplication symbols but other than that it seemed to work.
The CodeGenerator was not successful for me as it gave an output of a bunch of unneccessary symbols.

Connectez-vous pour commenter.

Réponses (2)

Muhammad Awais
Muhammad Awais le 24 Jan 2018
  1. open maple
  2. go into tools option
  3. click assistance option
  4. then click on code generation
  5. paste the maple code there and select the language you want to convert.
  6. press refresh and here it is..thank you :)
  4 commentaires
Alex
Alex le 29 Jan 2023
I want to translate the maple code precisely because I do not have a Maple license :(
Walter Roberson
Walter Roberson le 29 Jan 2023
Alex
In that case you are going to need to study the documentation of Maple to figure out how it operates and get accustomed to the way that people program in it. Personally I found that the 5th edition of the user manual (1990) was the best for learning the language, as back then it was an actual book intended to teach, not just a syntax and library interface description. You can going to find it difficult to learn the language well enough without having access to a copy of the program to execute tests with, but with the book in hand you should certainly be able to make some progress.
I would, however, suggest to you that if you are student or academic that getting a software license from Maplesoft would be a lot less expensive of your time than the cost of trying to learn the language well enough to translate code without having access to program.

Connectez-vous pour commenter.


Praveen kumar N
Praveen kumar N le 20 Jan 2017
select the math block from the maple and right click of the mouse the language conversion to MATLAB then u get a line of code and copy to matlab editor
  1 commentaire
Walter Roberson
Walter Roberson le 20 Jan 2017
This is true as far as it goes, but there are a lot of limitations in the conversion. The conversion is done by CodeGeneration[Matlab] by the way. It is extensible but it can be difficult to make more than minor changes.
There are a lot calls that the conversion cannot handle, and the output format is not nice. It uses floating point for even trivial numbers, and no spaces.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by