> Well, I also prefer gitlab, especially after recent controversies with > co-pilot > (https://www.infoworld.com/article/3627319/github-copilot-is-unacceptable-and-unjust-says-free-software-foundation.html), > though I'm not fervent about it...
> Yes, I do use org-babel and matlab. Until now, it hasn't been flawless > experience but I manage to get the results back. > But to be honest, I have no idea what mysterious mechanism enables me > that. It's not been long since I've been using emacs, so there's still > many lines in my init.el copied from here and there in a hope they > will do... > According to my notes I followed the instructions from here: > https://gewhere.github.io/blog/2017/12/19/setup-matlab-in-emacs-and-babel-orgmode/ > but nowwhen I inspect my init.el I can find only the code from the > last section of above-mentioned page ("Setup MATLAB with babel > orgmode"). > Besides installing matlab-mode I have also manually downloaded: > https://github.com/karthink/.emacs.d/blob/master/plugins/ob-octave-fix.el > and included in init.el following the discussion found here: > - https://www.reddit.com/r/emacs/comments/pufgce/matlab_mode/ > - > > https://www.reddit.com/r/emacs/comments/fy98bs/orgbabels_matlab_session_output_is_malformed/ > ... and that's all... org-babel and matlab somehow work together and I > try not to complain much... ;) Thanks I will study this later. What I am most interested is 1. Execute matlab code in a org buffer (with the correct block around the matlab code. 2. Insert the result directly in the org buffer. Here in exchange is my method. 1. The python engine shipped by mathworks (warning different matlab releases require different python versions, that is why I am stuck at the moment with R2019A, which still support python 3.5. 2. ob-ipython Actually the following steps ** Python3 and matlab-kernel: HOWTO sudo apt-get install python3-setuptools sudo -H python3 -m pip install jupyter sudo apt-get remove python3-pexpect sudo -H python3 -m pip install pexpect sudo -H python3 -m pip install matlab_kernel ** Install the python API for matlab. MATLABROOT=/usr/local/MATLAB/R2019a Cd $MATLABROOT/extern/engines/python sudo -H python3 setup.py install ** Start the engine Run /usr/bin/python3 in the python prompt: import matlab.engine eng = matlab.engine.start_matlab() the eng command needs some time to run. When finished run now eng.quit() #+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") ;; 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 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 #+RESULTS: #+begin_latex |1|2|3|4|5 #+end_latex Uwe -- I strongly condemn Hamas heinous despicable pogroms/atrocities on Israel I strongly condemn Putin's war of aggression against Ukraine. I support to deliver weapons to Ukraine's military. I support the EU and NATO membership of Ukraine.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss