Hi Uwe, I'm not sure if I get the issue, but I had this issue that figure does not pop out, and by just executing "set (0, "defaultfigurevisible", "on");" on the matlab-shell (only once) solved my problem. Maybe give it a try.
Best wishes, Shervin On Fri, Dec 3, 2021 at 11:19 AM Uwe Brauer <o...@mat.ucm.es> wrote: > * Matlab+python+org mode a problem with the plot command > > Hi > > The following is a bit off topic, my apologies, but it concerns matlab > and emacs and I hope that maybe someone on a list could give me a > hint. > > While matlab-mode is very useful for writing code and debug it, I also > need the feature of executing code and insert its result nicely > formatted in the buffer. > > This can be achieved by > > - first installing the python matlab kernel > https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html > - install the jupyter matlab kernel > sudo dpkg --purge python3-ptyprocess > sudo -H pip3 install --upgrade --force-reinstall --no-cache-dir jupyter > sudo -H pip3 install --upgrade --force-reinstall --no-cache-dir numpy > sudo -H pip3 install --upgrade --force-reinstall --no-cache-dir > pymatbridge > sudo -H pip3 install --upgrade --force-reinstall --no-cache-dir > matlab_kernel > - start the engine > https://de.mathworks.com/help/matlab/matlab_external/start-the-matlab-engine-for-python.html > - use org mode > - install ob-ipython. > - execute > #+BEGIN_SRC emacs-lisp > (setq org-confirm-babel-evaluate nil) ;don't prompt me to confirm > everytime I want to evaluate a block > ;;; 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") > ;(setq python-shell-interpreter "/usr/bin/python3.6") > ;(setq python-shell-interpreter "/usr/bin/python2.7") > ;; 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 > > Then use the following example > > > #+begin_src matlab :results output latex :exports results :eval > never-export :wrap latex > x = [1, 2, 3, 4, 5]; > fprintf('|%d', x) > #+end_src > > And it works like charm. > > However and now comes the question: > > #+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); > figure(1) > plot(t,y) > #+end_src > > The plot figure *does not* pop, while if I use the emacs matlab-shell it > does. > > If somebody has a clue or hint I would be extremely grateful > > regards > > Uwe Brauer > _______________________________________________ > Matlab-emacs-discuss mailing list > Matlab-emacs-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss >
_______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss