>>> "Cumhur" == Cumhur Erkut <cumhur.er...@gmail.com> writes:

    > Hi, 

    > Assuming that matlab-mode and matlab-shell are working, org-babel
    > natively supports matlab code execution.

    > Your org-babel-execute:matlab overrides the org-babel defaults in
    > ob-octave.el, which can be inspected there.

    > I enable the babel support in .emacs as

    > (org-babel-do-load-languages
    >  'org-babel-load-languages
    >  '(

    > (setq org-babel-default-header-args:matlab
    >   '((:session . "*MATLAB*")
    >     (:results . "silent")
    >     )
    > )

    > More an org answer than matlab.el, but I hope these help.

Right: your code uses the matlab-shell, which writes its results in the
*MATLAB* shell buffer, but I want the result (at least optional) to be
written in the org buffer. So a typical org file after executing matlab
looks like
,----
| 
| \droppoints
| \begin{displaymath}
|      \begin{cases}
|        \frac{du}{dt}&= -t u^2,\\
|        u(0)&=1,
|      \end{cases}
|    \end{displaymath}
| 
| Solve using ...
| 
| 
| #+BEGIN_solution
| #+begin_src matlab :results output latex :exports results  :eval never-export 
| f=@(t,y)[-t*y^2];
| [t,y]=mieuler(f,[0 1],1,2);
| disp('\begin{align*}')
| fprintf('t = [%g \\qquad %g \\quad %g]  \\\\\n', t)
| fprintf('y = [%g \\qquad %g \\qquad %g] \n', y)
| disp('\end{align*}')
| #+end_src
| 
| #+RESULTS:
| #+BEGIN_EXPORT latex
| \begin{align*}
| t = [0 \qquad 0.5 \quad 1]  \\
| y = [1 \qquad 1 \qquad 0.75] 
| \end{align*}
| #+END_EXPORT
| 
`----

This is what the hack does and it does it nicely, the only problem is
that every time I execute the code matlab is started again, and for more
recent versions of matlab this can take some time. So the question is
whether the hack I used, could use the matlab-shell.

Uwe Brauer 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to