emacs-orgmode
[Top][All Lists]
Advanced

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

matlab+kernel+jupyter+python: works nicely save the plot command


From: Uwe Brauer
Subject: matlab+kernel+jupyter+python: works nicely save the plot command
Date: Wed, 24 Nov 2021 14:23:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hi

Using Ubuntu, python 3.5 matlab 2019a and the python matlab kernel
mathworks provides (and ob-ipython, but I presume that 
scimax (https://github.com/jkitchin/scimax) 
and https://github.com/nnicandro/emacs-jupyter would behave similar.

After starting the python-matlab engine I do

#+BEGIN_SRC emacs-lisp
(setq org-confirm-babel-evaluate nil)  
;;; display/update images in the buffer after I evaluate
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
    
(add-to-list 'org-src-lang-modes '("matlab" . matlab))
(setq python-shell-interpreter "python3")
;; 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


#+begin_src matlab :results output latex :exports code  :eval never-export 
:wrap latex
clear all
close all
t=[0:0.1:1];
y=sin(t);
plot(t,y)
print -dpng  simple.png 
#+end_src

The print command succeeds the simple.png file is generated, however I
cannot see the figure with the plot, it never pops up.

What is wrong in my setting?

Regards

Uwe Brauer 




reply via email to

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