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