emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] workflow, matlab+latex in org file


From: John Kitchin
Subject: Re: [O] workflow, matlab+latex in org file
Date: Sat, 11 Mar 2017 14:22:46 +0000

The kernel provides a "session" so matlab stays alive and doesn't have to restart on every block. 

The kernel might require python3. 
On Sat, Mar 11, 2017 at 9:20 AM Uwe Brauer <address@hidden> wrote:

   > You might dig around in ob-octave to see how it works. It should be able
   > to Matlab (and on Linux/Mac I believe it might). On Windows, it has been
   > broken for a long time due to the lack of a proper shell (maybe that can
   > be adapted in win10 though).

   > I vaguely recall making that matlab function to try it out on Windows
   > some years ago.

   > There is a Jupyter Matlab kernel now.
   > https://github.com/Calysto/matlab_kernel


Thanks for pinting it out to me. Couldn't  install it so far
ImportError: No module named pathlib
when trying directly to use >python -m matlab_kernel install

Or ould not find a version that satisfies the requirement backports.tempfile (from matlab-kernel) (from versions: 1.0rc1, 1.0rc1)
Cleaning up...
No distributions matching the version for backports.tempfile (from matlab-kernel)
Storing debug log for failure in /home/oub/.pip/pip.log

Have to write the author.

The output using your code and Eric's suggestion is ok but I am curious
to see what the kernel is supposed to do better.

Uwe
   > I was able to use this (and installing the kernel, and making sure a
   > matlab is on the path):

   > #+BEGIN_SRC emacs-lisp
   > (add-to-list 'org-src-lang-modes '("matlab" . matlab))

   > ;; set default headers for convenience
   > (setq org-babel-default-header-args:matlab
   >       '((:results . "output replace")
   >    (:session . "matlab")
   >    (:kernel . "matlab")
   >    (:exports . "code")
   >    (:cache .   "no")
   >    (:noweb . "no")
   >    (:hlines . "no")
   >    (:tangle . "no")))

   > (defalias 'org-babel-execute:matlab 'org-babel-execute:ipython)
   > (defalias 'org-babel-prep-session:matlab 'org-babel-prep-session:ipython)
   > (defalias 'org-babel-matlab-initiate-session 'org-babel-ipython-initiate-session)
   > #+END_SRC


   > #+RESULTS:
   > : org-babel-matlab-initiate-session

   > To enable this:

   > #+BEGIN_SRC matlab :results output org drawer
   > x = [1, 2, 3, 4, 5];
   > fprintf('|%d', x)
   > #+END_SRC

   > #+RESULTS:
   > :RESULTS:
   > | 1 | 2 | 3 | 4 | 5 |
   > :END:

   > It is not much better output wise without the fprintf, but that seems to
   > be a feature of Matlab's output. I think Eric is probably right, you
   > will have use fprintf to get what you want.

   > I am not a big matlab user these days, so I do not have a sense for how
   > usable the kernel is. It does run in a session, which is a big
   > improvement over the other one I wrote.

   > Uwe Brauer writes:



--
John

-----------------------------------
Professor John Kitchin 
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]