From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [BABEL] Output with octave Date: Sun, 01 Aug 2010 14:18:40 -0400 Message-ID: <871vai42nz.fsf@stats.ox.ac.uk> References: <87iq45x06e.wl%ucecesf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=46292 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ofd7Y-0003JG-JB for emacs-orgmode@gnu.org; Sun, 01 Aug 2010 14:18:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ofd7V-0006vl-Pu for emacs-orgmode@gnu.org; Sun, 01 Aug 2010 14:18:47 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:46046) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ofd7V-0006vT-HG for emacs-orgmode@gnu.org; Sun, 01 Aug 2010 14:18:45 -0400 In-Reply-To: <87iq45x06e.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Sat, 24 Jul 2010 00:12:25 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric S Fraga Cc: emacs-orgmode@gnu.org, "d.tchin" Eric S Fraga writes: > On Fri, 23 Jul 2010 16:59:43 +0000 (UTC), d.tchin wrote: >> >> Hi >> >> I use babel to use with octave language. I use it and >> define a session so as to have interaction with >> octave process. >> >> It is great to have interaction with octave and >> check the action of the code easily. >> >> I have problem to get output back in org mode file. >> I try the following code : >> >> >> --8<---------------cut here---------------start------------->8--- >> #+tblname: test >> | 1 | 2 | 3 | >> >> #+source: outtest >> #+begin_src octave :session *out* :var vec=test :results output >> vecb=vec; >> vecb >> #+end_src >> >> --8<---------------cut here---------------end--------------->8--- >> >> You will get following output >> >> #+results: outtest >> : vec = >> : >> : 1 2 3 >> : octave.exe> vecb = >> : >> : 1 2 3 >> >> As you see I get two outputs : vec variable and vecb (with octave prompt). >> It is what I expected, excepted vec output. The inclusion of the prompt is undesirable, and that is now on a to-fix list. But the ":results value" problems are more serious: >> >> With :results value >> >> --8<---------------cut here---------------start------------->8--- >> #+tblname: test >> | 1 | 2 | 3 | >> >> >> >> #+source: outtest >> #+begin_src octave :session *out* :var vec=test :results value >> vecb=vec; >> vecb >> #+end_src >> >> --8<---------------cut here---------------end--------------->8--- >> >> I get the following output >> >> >> #+results: outtest >> : org_babel_eoe OK, perhaps you or other octave users could advise us on how to proceed here, as neither Eric Schulte nor I know octave. Note that this works: #+begin_src octave :session *out* :var vec=test vecb=vec; vecb+0 #+end_src #+results: : 1.00000000e+00 2.00000000e+00 3.00000000e+00 octave evaluation in org works as follows: - The user code is evaluated - The value of the variable 'ans' is written to disk and imported into org And the octave manual tells us that 'ans' is: ,---- | The most recently computed result that was not explicitly assigned to a variable `---- The trouble seems to be that the final expression 'vecb' doesn't count as a computation, and so doesn't change the value of ans. So the current workaround is to say "when using octave, you must end your block with a computation, rather than a simple statement of a variable name." Can someone suggest a better solution? Dan p.s. Or you could do this #+begin_src octave :session *out* :var vec=test vecb=vec; ans=vecb #+end_src #+begin_src octave :session *out* :var vec=test vecb=vec; ans=vecb ans #+end_src >> >> In the octave process, I check that it the last intruction. But >> what I would expect is to get last instruction vecb. >> >> I certainly miss something. Could someone help me on this ? > > I don't think you are missing anything obvious as for the ":results > value" case, I get the same thing. In fact, for ":results output", I > don't actually get any output! I'm not sure why. I wonder if there > is a dependence on the version of Octave? I'm using a fairly old > version (3.0.x instead of 3.2.x). > > : Org-mode version 7.01trans (release_7.01g.24.g6b5cf) > : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) > : of 2010-05-16 on raven, modified by Debian