How do I translate code from Maple to MATLAB?

조회 수: 29 (최근 30일)
Samy
Samy 2013년 7월 19일
댓글: Walter Roberson 2023년 1월 29일
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
Muthu Annamalai
Muthu Annamalai 2013년 7월 19일
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 2021년 1월 20일
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.

댓글을 달려면 로그인하십시오.

답변 (2개)

Muhammad Awais
Muhammad Awais 2018년 1월 24일
  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
Alex
Alex 2023년 1월 29일
I want to translate the maple code precisely because I do not have a Maple license :(
Walter Roberson
Walter Roberson 2023년 1월 29일
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.

댓글을 달려면 로그인하십시오.


Praveen kumar N
Praveen kumar N 2017년 1월 20일
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
Walter Roberson
Walter Roberson 2017년 1월 20일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by