emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Juan Pechiar <pechiar@computer.org>
To: Dan Davison <davison@stats.ox.ac.uk>
Cc: emacs-orgmode@gnu.org, "d.tchin" <d.tchin@voila.fr>
Subject: Re: Re: [BABEL] Output with octave [PATCH]
Date: Sun, 1 Aug 2010 17:22:14 -0300	[thread overview]
Message-ID: <20100801202214.GU5569@soloJazz.com> (raw)
In-Reply-To: <20100801200727.GT5569@soloJazz.com>

Hi,

Below is a single PATCH for the 3 issues:
   - passing tables with EXP or complex notation to octave
   - correct formatting of matrixes into octave
   - interpretation of octave output as table

Regards,
.j.

8<------------------------------------------------------------

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 8e99f86..bf7fdd3 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -119,8 +119,9 @@ end")
 Converts an emacs-lisp variable into a string of octave code
 specifying a variable of the same value."
   (if (listp var)
-      (concat "[" (mapconcat #'org-babel-octave-var-to-octave var ",
") "]")
-    (format "%S" var)))
+      (concat "[" (mapconcat #'org-babel-octave-var-to-octave var
+                            (if (listp (car var)) "; " ",")) "]")
+    (format "%s" var)))

 (defun org-babel-prep-session:octave (session params &optional
 matlabp)
   "Prepare SESSION according to the header arguments specified in
   PARAMS."
@@ -181,7 +182,7 @@ value of the last statement in BODY, as elisp."
               (org-babel-eval
                cmd
                (format org-babel-octave-wrapper-method body tmp-file
                tmp-file))
-              (org-babel-eval-read-file tmp-file))))))
+              (org-babel-octave-import-elisp-from-file tmp-file))))))

 (defun org-babel-octave-evaluate-session
   (session body result-type &optional matlabp)

8<------------------------------------------------------------

On Sun, Aug 01, 2010 at 05:07:27PM -0300, Juan wrote:
> I'm starting to work with ob-octave and found several problems:
>
> The first, for which I have a fix (see patch below) is that octave's
> output was passed on as a string instead of being interpreted as a table:


> The second problem is that if I use octave table output as input to
> another block, it gets interpreted as a string instead of a vector:


> This has to do with the EXP notation. The 'e+00' suffix makes the
> whole table into a string. The problem is with "%S" in the formatting
> inside org-babel-octave-var-to-octave.


> A third problem is with org-babel-octave-var-to-octave.
>
> For example:
>
> : (org-babel-octave-var-to-octave '( ( 1 2 3 ) ( 4 5 6 ) ))
> : ->  "[[1, 2, 3], [4, 5, 6]]"
>
> This is not a 2x3 matrix, but a 1x6 vector:
>
> : octave-3.2.3:1> [[1,2,3],[4,5,6]]
> : ans =
> :    1   2   3   4   5   6
>
> a semicolon ';' or '\n' is needed between rows instead of a comma.

  reply	other threads:[~2010-08-01 20:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 16:59 [BABEL] Output with octave d.tchin
2010-07-23 23:12 ` Eric S Fraga
2010-07-26 14:25   ` d.tchin
2010-08-01 18:18   ` Dan Davison
2010-08-01 20:07     ` Re: [BABEL] Output with octave + [PATCH] x2 Juan
2010-08-01 20:22       ` Juan Pechiar [this message]
2010-08-04  4:18         ` [BABEL] Output with octave [PATCH] Dan Davison
2010-08-04 15:15           ` d.tchin
2010-08-01 22:19       ` [BABEL] Output with octave + [PATCH] x2 Dan Davison
2010-08-01 22:55         ` [BABEL] Octave issues Juan
2010-08-01 23:32           ` Dan Davison
2010-08-02  9:30     ` [BABEL] Output with octave d.tchin
2010-08-04  4:15       ` Dan Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100801202214.GU5569@soloJazz.com \
    --to=pechiar@computer.org \
    --cc=d.tchin@voila.fr \
    --cc=davison@stats.ox.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).