ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 25 Oct 2010 17:04:34 +0200Is it possible to use Matlab Code to control SAGE?https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/Hi,
i'm joining a course at University that requires me to use MatLab and although there is a Campus License available, I'd prefer to use an open source program. However, I'm required to turn in the exercise as compileable MatLab code. Browsing the web for alternatives, I found Sage and now I wonder if I can use "proper" MatLab code in Sage.
Thanks for the time you take to read and answer my question!
NeuneckMon, 25 Oct 2010 13:34:59 +0200https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/Comment by ccanonc for <p>Hi,</p>
<p>i'm joining a course at University that requires me to use MatLab and although there is a Campus License available, I'd prefer to use an open source program. However, I'm required to turn in the exercise as compileable MatLab code. Browsing the web for alternatives, I found Sage and now I wonder if I can use "proper" MatLab code in Sage.</p>
<p>Thanks for the time you take to read and answer my question!</p>
<p>Neuneck</p>
https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?comment=22536#post-id-22536http://www.gnu.org/software/octave/Mon, 25 Oct 2010 13:46:31 +0200https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?comment=22536#post-id-22536Answer by niles for <p>Hi,</p>
<p>i'm joining a course at University that requires me to use MatLab and although there is a Campus License available, I'd prefer to use an open source program. However, I'm required to turn in the exercise as compileable MatLab code. Browsing the web for alternatives, I found Sage and now I wonder if I can use "proper" MatLab code in Sage.</p>
<p>Thanks for the time you take to read and answer my question!</p>
<p>Neuneck</p>
https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?answer=11753#post-id-11753I believe this is not possible. Sage can accept pure MatLab code, or code from a number of other systems, but only when it's acting as a console for those systems -- see the [interfaces](http://www.sagemath.org/doc/reference/interfaces.html) section of the manual -- the purpose of Sage interfaces is rather the opposite of what you're looking for: interfaces allow you to use *Sage syntax* to run other programs. And it works by calling those programs from Sage, so you have to install them and use them. As I understand it, this is useful really only for those who want to use several different programs side-by-side. If you will be using only a single program, it makes more sense to interact with it directly if you can.
If the course has a small number of people in it and your instructor is willing to be flexible, you might try pointing out that public servers like [sagenb.org](http://sagenb.org) would allow them to evaluate the functionality of Sage code without having to go through the (easy) process of installing Sage. But if homework grading is going to be automated, your instructor probably isn't willing to go through the trouble of adding support for Sage. And you're both going to be unhappy if, midway through the term, you find that Sage doesn't have support for some topics in the course.
Whatever ends up happening, bear in mind that you will have more opportunities to use open source software in the future, even if you don't have that choice as a student.Mon, 25 Oct 2010 14:57:50 +0200https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?answer=11753#post-id-11753Answer by burcin for <p>Hi,</p>
<p>i'm joining a course at University that requires me to use MatLab and although there is a Campus License available, I'd prefer to use an open source program. However, I'm required to turn in the exercise as compileable MatLab code. Browsing the web for alternatives, I found Sage and now I wonder if I can use "proper" MatLab code in Sage.</p>
<p>Thanks for the time you take to read and answer my question!</p>
<p>Neuneck</p>
https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?answer=11755#post-id-11755There is also [an Open-Source MATLAB®-to-Python® Compiler][1], which you can use to run your matlab code in Python. It would be great if this was better integrated with the notebook so that you could have "%ompc" cells that were compiled to python behind the scenes and executed, much like what happens with "%cython" or "%fortran" now.
[1]: http://ompc.juricap.com/Mon, 25 Oct 2010 17:04:34 +0200https://ask.sagemath.org/question/7741/is-it-possible-to-use-matlab-code-to-control-sage/?answer=11755#post-id-11755