2
votes

I did some symbolic calculations in Mathematica and want to transfer the result to MATLAB, i.e. export the output of Mathematica calculations to valid MATLAB syntax.

There is a question on mathematica.stackexchange which asks the same thing, but the accepted answer is too limited for what I want. Specifically, the ToMatlab package was suggested.

I need a similar package, which can doesn't share the same flaws, like not handling atan2.

So, does anybody know a working alternative to the ToMatlab package?

1
From the help center: Questions asking us to recommend or find a software library or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. You may be better asking this question back on mathematica.stackexchange, where there are obviously people willing to answer (as evidenced by your linked question) - Wolfie
Okidoki, sorry for the inconvenience - user2629617
'ToMatLab' is an open-source Mathematica package, which could be brought up-to-date. The OP is asking for any Mathematica code/package that could export to Matlab. Such a package could be posted here and would not necessarily be an off-site resource. - Chris Degnen

1 Answers

1
votes

If you examine 'ToMatLab.m' you will see the simple literal conversions for trig functions. Just add your function and see if it works.

ToMatlabaux[Sin] = "sin"
ToMatlabaux[Cos] = "cos"
ToMatlabaux[Tan] = "tan"
ToMatlabaux[Cot] = "cot"

The ToMatLab package is actually quite a small piece of code.