emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [babel] how to pass data to gnuplot from another block


From: Eric Schulte
Subject: Re: [O] [babel] how to pass data to gnuplot from another block
Date: Thu, 05 Dec 2013 11:29:15 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Eric S Fraga <address@hidden> writes:

> Eric Schulte <address@hidden> writes:
>
>> Hi Eric,
>>
>> The attached works fine for me (using sh since I don't have octave).
>
> Dear Eric,
>
> thanks for your quick reply and sorry for taking so long to get back to
> you.  I ended up going to Chile for a week the day after sending my
> original email and had very little Internet access (and, actually, no
> time even if I had had proper connectivity).  Back now!
>
> [...]
>
>> Ensure that the data you're passing into gnuplot is a table and not a
>> string.  Gnuplot blocks handle tables by writing them to a file, and
>> then replacing the variable with the file name.  As I recall gnuplot
>> blocks assume string data already is a file name, so the variable is
>> replaced directly.
>
> Ah ha, this is a subtle one!  The output looks the same in either case,
> as Nick D. also notes.  By changing the results generated to value and
> not output and adding an expression at the end of my octave code to
> generate the value required got things working.
>
> The subtlety makes this a rather frustrating experience, however.  Is
> there any way to convince babel to treat a string output as an org table
> so that subsequent chaining works in this case as well?
>

I'm not familiar with ob-octave, but I'd imagine ":results vector"
should do the trick.  If not then it might be worth adding something
like the following (borrowed from ob-sh.el) to ob-octave.

    (org-babel-result-cond (cdr (assoc :result-params params))
      results
      (let ((tmp-file (org-babel-temp-file "sh-")))
        (with-temp-file tmp-file (insert results))
        (org-babel-import-elisp-from-file tmp-file)))

Best,

>
> Thanks again,
> eric

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



reply via email to

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