From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marvin Doyley Subject: Re: org-babel pass data between blocks Date: Mon, 28 Apr 2014 10:52:39 -0400 Message-ID: <6B0E0BC1-A964-40AA-829E-02080D3084A0@gmail.com> References: <9F2375C3-005C-49EF-8E74-A3B2E5DB713B@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_530C0FEA-387A-4F0D-BD3F-31F869C946C3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wemvp-0001mr-A9 for emacs-orgmode@gnu.org; Mon, 28 Apr 2014 10:53:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wemvk-0003wj-GD for emacs-orgmode@gnu.org; Mon, 28 Apr 2014 10:53:21 -0400 Received: from mail-qc0-x22b.google.com ([2607:f8b0:400d:c01::22b]:36729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wemvk-0003wK-Ax for emacs-orgmode@gnu.org; Mon, 28 Apr 2014 10:53:16 -0400 Received: by mail-qc0-f171.google.com with SMTP id c9so6976864qcz.16 for ; Mon, 28 Apr 2014 07:53:15 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Alan Schmitt Cc: emacs-orgmode@gnu.org --Apple-Mail=_530C0FEA-387A-4F0D-BD3F-31F869C946C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Thanks, Your first option works like a charm cheers, M On Apr 28, 2014, at 9:07 AM, Alan Schmitt = wrote: > On 2014-04-28 14:41, Marvin Doyley writes: >=20 >> Dear All, >>=20 >> Is there way to pass data between blocks in org-babel. For example = lets say have two blocks >>=20 >>=20 >> #+begin_src python >> from pylab import * >> # Simple carrier >> t=3Dlinspace(0,1,100); >> fc=3D100; >> Ac =3D1; >> C=3DAc*cos(2*pi*t); >>=20 >> #+end_src >>=20 >>=20 >> What I would like to do is to pass both C and t to another python = block, but it is not clear how to do this. >>=20 >> #+begin_src python=20 >> from pylab import * >>=20 >> fm=3D1; >> Am=3D1 >> m=3DAm*cos(2*pi*t); # message signal >>=20 >> z=3Dm*C; #double side-band modulated signal >>=20 >> #+end_src >=20 > I see three options (there are probably many others): > - use a session (see > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html > for instance); > - have C and t be the results of the first block, and chain the = blocks; > - use noweb to include the second block is the first block. >=20 > Alan --Apple-Mail=_530C0FEA-387A-4F0D-BD3F-31F869C946C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Thanks,

Your first option works = like a = charm

cheers,
M
On Apr = 28, 2014, at 9:07 AM, Alan Schmitt <alan.schmitt@polytechnique.= org> wrote:

On 2014-04-28 14:41, Marvin Doyley = <marvinpas@gmail.com> = writes:

Dear All,

Is there way = to pass data between blocks in org-babel. For example lets say have two = blocks


#+begin_src python
from pylab import *
# Simple = carrier
t=3Dlinspace(0,1,100);
fc=3D100;
Ac = =3D1;
C=3DAc*cos(2*pi*t);

#+end_src


What I would = like to do is to pass both C and t to another python block, but it is = not clear how to do this.

#+begin_src python 
from pylab import = *

fm=3D1;
Am=3D1
m=3DAm*cos(2*pi*t); # message = signal

z=3Dm*C;   #double side-band modulated = signal

#+end_src

I see three options (there = are probably many others):
- use a session (see
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.ht= ml
for instance);
- have C and t be the results of the first = block, and chain the blocks;
- use noweb to include the second block = is the first = block.

Alan

= --Apple-Mail=_530C0FEA-387A-4F0D-BD3F-31F869C946C3--