From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Emacs Org mode mailing list <emacs-orgmode@gnu.org>
Subject: [bug?] [babel] cannot generate table format output for octave results
Date: Fri, 14 Jan 2011 09:22:22 +0000 [thread overview]
Message-ID: <8762trdelt.fsf@ucl.ac.uk> (raw)
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)
next reply other threads:[~2011-01-14 10:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 9:22 Eric S Fraga [this message]
2011-04-14 3:44 ` [bug?] [babel] cannot generate table format output for octave results Ethan Ligon
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=8762trdelt.fsf@ucl.ac.uk \
--to=e.fraga@ucl.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).