emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [bug?] [babel] cannot generate table format output for octave


From: Eric S Fraga
Subject: [Orgmode] [bug?] [babel] cannot generate table format output for octave results
Date: Fri, 14 Jan 2011 09:22:22 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Hello,

I want an octave babel code block to generate an org table as the
/result/ so that it can be used by another code block elsewhere in my
document.  Typically, because of how I generate my data, I would like
babel to create the table from the /output/ of the octave code, not the
value.  However, specifying =:results output table= doesn't seem to work
(for me, in any case).

The following is an example with two octave babel code blocks.  The
first asks for the /value/ of the block to be extracted and converted to
an org table.  This works fine.  The second block asks for the /output/
to be converted.  This doesn't work in that the output is not converted
to org table syntax *and* the output is encapsulated in an /example/
block.

--8<---------------cut here---------------start------------->8---

  #+srcname: valueresult
  #+begin_src octave :results value table
values = [];
for i=1:15
  values(end+1,:) = [i, i^3];
endfor
ans = values
  #+end_src

  #+results: valueresult
  |  1 |    1 |
  |  2 |    8 |
  |  3 |   27 |
  |  4 |   64 |
  |  5 |  125 |
  |  6 |  216 |
  |  7 |  343 |
  |  8 |  512 |
  |  9 |  729 |
  | 10 | 1000 |
  | 11 | 1331 |
  | 12 | 1728 |
  | 13 | 2197 |
  | 14 | 2744 |
  | 15 | 3375 |

  #+srcname: outputresult
  #+begin_src octave :results output table
values = [];
for i=1:15
  values(end+1,:) = [i, i^3];
endfor
disp(values)
  #+end_src

  #+results: outputresult
  #+begin_example
        1      1
        2      8
        3     27
        4     64
        5    125
        6    216
        7    343
        8    512
        9    729
       10   1000
       11   1331
       12   1728
       13   2197
       14   2744
       15   3375
#+end_example
--8<---------------cut here---------------end--------------->8---

I should add that I am having a great deal of fun with org and babel at
the moment!  I am finishing off a paper and the presentation of the
results of my research requires me to run some code (octave) to generate
a rather large set of results that go into a number of data files.  I
then process these files with a shell script block using awk to extract
the necessary information for presentation. The output of this is passed
to another octave block which does some data analysis.  The analysis
results are then passed to a gnuplot block.  Very simple chain of blocks
that I used to do all separately but that I can now have in a single
document.  In fact, I have two chains from the same initial code to
present two different aspects of the results.

Babel is fantastic basically.  Well, so is org, of course.  Thanks
(again and again) to all org and babel implementers!

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 23.2.1
: using Org-mode version 7.4 (release_7.4.174.g163cd)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]