On 22.04.2024 14:52, Uwe Brauer wrote:
Hi

Some comments, since it did not work as expected.


On 21.04.2024 19:40, Uwe Brauer wrote:
Your approach is indeed cumbersome.
In mine we need to:
1. Install `matlab-support` - a  debian package that enables matlab
integration within the system:
sudo apt install matlab-support
installed

2. In Emacs: install `matlab-mode` package
installed
3. Download
https://github.com/karthink/.emacs.d/blob/master/plugins/ob-octave-fix.el
Installed

and put it somewhere  in Emacs search path.
4. My init.el content with matlab/org-babel configurations:
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; enabling org-babel
(org-babel-do-load-languages
   'org-babel-load-languages '(
                   (C . t) ; enable processing C, C++, and D source blocks
                   (matlab . t)
                   ;;(perl . t)
                   (octave . t)
                   (org . t)
                   (python . t)
                               (plantuml . t)
                   (shell . t)
                    ))
;; setup matlab in babel
(setq org-babel-default-header-args:matlab
    '((:results . "output") (:session . "*MATLAB*")))
;; octave/matlab-fix
;;;; (require 'ob-octave-fix nil t)    ; This is for older approach
(require 'ob-octave-fix)
done.


Now I executed

#+begin_src matlab
x = [1, 2, 3, 4, 5];
fprintf('|%d', x)
#+end_src

And obtained in a different window:
--8<---------------cut here---------------start------------->8---

NameErrorTraceback (most recent call last)
<ipython-input-3-e039b5096438> in <module>
       1 x = [1, 2, 3, 4, 5];
----> 2 fprintf('|%d', x)

NameError: name 'fprintf' is not defined

--8<---------------cut here---------------end--------------->8---

So

     1. the result is not inserted in my org buffer,

     2. Morever fprintf is not defined, let me suspect this is not matlab
        what is excecuted but octave. Am I right?

What do I miss here?


Uwe


Well...

1. After installing matlab-support you should be able to Matlab from bash by typing the command

>> matlab

Can you do that?

   a) if yes

       Can you evoke matlab-shell in Emacs? (M-x matlab-shell)

       Again, you should be able to do that after installing matlab-mode.

   b) if no:

       check what are the values of the variables: `matlab-shell-command` and `matlab-shell-command-switches`

       In my case they are equal: `matlab` and ("-nodesktop"), respectively, which is by default set in `matlab-shell.el` which is a part of matlab-mode package.

      Maybe you need to set them explicitely like here:

     https://swang251.github.io/2021/12/03/Matlab-in-Emacs/

     ???






_______________________________________________
Matlab-emacs-discuss mailing list
Matlab-emacs-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss

Reply via email to