From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darlan Cavalcante Moreira Subject: [org-babel] Feature request: Get a scalar for "data=example-table[0, 1]" Date: Wed, 21 Apr 2010 16:37:07 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4b3K-0001gj-IT for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 10:37:22 -0400 Received: from [140.186.70.92] (port=47047 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4b3D-0001Xf-PF for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 10:37:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4b38-0008KY-CO for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 10:37:15 -0400 Received: from mail-bw0-f225.google.com ([209.85.218.225]:62649) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4b37-0008KF-Qb for emacs-orgmode@gnu.org; Wed, 21 Apr 2010 10:37:10 -0400 Received: by bwz25 with SMTP id 25so7281391bwz.8 for ; Wed, 21 Apr 2010 07:37:07 -0700 (PDT) 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 In the org-babel documentation we see that one can pass a single element from a table to a babel source block with ,---- ! :var data=example-table[0,1] `---- I assumed that I would get a scalar value, but it seems that I still get a table (but with only one element). For instance, if I have the table below #+TBLNAME: MyTable | X | Y | |-----+----| | 0 | 0 | | 1 | 1 | | 2 | 4 | | 3 | 9 | | 4 | 16 | | 5 | 25 | |-----+----| | Sum | 55 | #+TBLFM: $2=$1*$1::@8$2=vsum(@2..@-1) then the code in python to print the value of sum returns ,---- ! #+begin_src python :var sum=MyTable[9,1] :results output :exports none ! print sum ! #+end_src ! ! #+results: ! : [[55]] `---- but I would expect to get only 55, since I'm getting a specific element in MyTable and not a sub-table. In addition, the hlines are being counted. Is this intended behaviour? I remember that there is a thread in the list about keeping the hlines in resulting tables, but even if that is desirable, counting the hlines as lines will result in troubles (python give me an error if I use sum=MyTable[9,1], for instance). I was trying to plot the table with Org-Babel and Gnuplot with the code below #+begin_src gnuplot :var data=MyTable[1:-2] :var sum=MyTable[7,1] :results silent :exports none reset set label "Sum: %.0f",sum at graph 0.03, graph 0.93 plot data with linespoints #+end_src but the sum variable will have the value of a temporary file with the element [7,1] instead of the actual value. I could use ":var sum=55" but then I would have to change this whenever I change the table. - Darlan ps: How do I do that "cute here start/end"? Is it gnus functionality (I use wanderlust) or it is more general?