From mboxrd@z Thu Jan 1 00:00:00 1970 From: d.tchin Subject: Re: [BABEL] Output with octave Date: Mon, 2 Aug 2010 09:30:24 +0000 (UTC) Message-ID: References: <87iq45x06e.wl%ucecesf@ucl.ac.uk> <871vai42nz.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=37070 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfrM4-0007ur-19 for emacs-orgmode@gnu.org; Mon, 02 Aug 2010 05:30:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfrM2-0001dg-JC for emacs-orgmode@gnu.org; Mon, 02 Aug 2010 05:30:43 -0400 Received: from lo.gmane.org ([80.91.229.12]:57053) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfrM2-0001d4-87 for emacs-orgmode@gnu.org; Mon, 02 Aug 2010 05:30:42 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OfrLx-00026z-3b for emacs-orgmode@gnu.org; Mon, 02 Aug 2010 11:30:37 +0200 Received: from APuteaux-754-1-30-218.w90-44.abo.wanadoo.fr ([90.44.69.218]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Aug 2010 11:30:37 +0200 Received: from d.tchin by APuteaux-754-1-30-218.w90-44.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Aug 2010 11:30:37 +0200 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: emacs-orgmode@gnu.org Hi, Dan Davison stats.ox.ac.uk> writes: > > Eric S Fraga ucl.ac.uk> writes: > > > On Fri, 23 Jul 2010 16:59:43 +0000 (UTC), d.tchin voila.fr> wrote: > >> > >> 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 > Thank you for the help. I will use it as it works clearly clearly well. Following exchange you have with Juan Pechiar related to the way the output is displayed, I would like to submit the following examples : First test : --8<---------------cut here---------------start------------->8--- #+tblname: test | 1 | 2 | 3 | #+source: outtest #+begin_src octave :session *out* :var vec=test :results value vector vecb=[vec]; ans=vecb; #+end_src --8<---------------cut here---------------end--------------->8--- The output is the following : #+results: outtest | 1.00000000e+000 2.00000000e+000 3.00000000e+000 | It is considered as one character and each element are not clearly splitted in table. Certainly handled as string as Juan Pechiar. Second test : --8<---------------cut here---------------start------------->8--- #+tblname: test | 1 | 2 | 3 | #+source: outtestb #+begin_src octave :session *out* :var vec=test :results value vector vecb=[vec;vec]; ans=vecb; #+end_src --8<---------------cut here---------------end--------------->8--- The output is the following : #+results: outtestb | 1.00000000e+000 | 2.00000000e+000 | 3.00000000e+000 | | 1.00000000e+000 | 2.00000000e+000 | 3.00000000e+000 | This time output is splitted in a table as it should be ?