1

Sometimes I have to analyze quite large matrices with octave as part of a documented reproducible work. Org files with Octave source blocks are the ideal format for that purpose.

One defines the matrix in one Octave source block running a session and analyzes the matrix in successive Octave source blocks with the same session and with descriptive texts in between.

Pityingly, bigger matrices cannot be read in an Octave session.

The following Elisp-script generates an Octave source block with a 26x26 matrix. The execution of the Octave source block fails in the session oct with the following output in the inferior octave buffer:

The error output:

'org_babel_eoe'
> parse error:

  syntax error

>>> if isch
     ^

octave> parse error:

  syntax error

>>> else, dlmwrite('/tmp/babel-N8s61a/octave-TCIyvs', ans, '\t')
       ^

octave> parse error:

  syntax error

>>> end
      ^

octave> ans = org_babel_eoe
octave> 

The Elisp script that generates the Octave source block. The script is also an Org source block. You can copy it to an Org file and execute it.

#+BEGIN_SRC emacs-lisp :var n=26 :results raw
(cl-flet ((printrow (n row)
            (dotimes (col (1- n))
              (insert (format "%d.%d, " row col)))
            (insert (format "%d.%d" row n))))
  (with-temp-buffer
    (insert "#+BEGIN_SRC octave :session oct\n"
        "ans = [\n")
    (dotimes (row (1- n))
      (printrow n row)
      (insert ";\n"))
    (printrow n n)
    (insert "]\n"
        "#+END_SRC")
    (buffer-string)))
#+END_SRC

Can anybody reproduce the effect? What is going on? Any chance to fix it?

I've tested the 26x26 matrix already in octave-cli in the shell. That works.

Reproduction conditions:

  • Operating system: Ubuntu 18.04.1
  • Emacs: 26.3
  • Org-version: 9.2.6
Tobias
  • 32,569
  • 1
  • 34
  • 75
  • Works fine here: Org mode version 9.3.7 (release_9.3.7-644-ge3a724 @ /home/nick/elisp/org-mode/lisp/) on GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0) of 2020-06-15 – NickD Jun 18 '20 at 15:32
  • @NickD Thanks for the test. I've tested now with Org version 9.3.7 and Emacs 26.3. Therewith the effect is still reproducible. Maybe, I update to Emacs 27. But, that will take some time. Maybe, it is a problem with inferior-octave. – Tobias Jun 19 '20 at 14:06
  • Bug still exits in emacs 27.2 – unDeadHerbs Feb 25 '22 at 19:48

0 Answers0