emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel pass data between blocks
@ 2014-04-28 12:41 Marvin Doyley
  2014-04-28 13:07 ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Marvin Doyley @ 2014-04-28 12:41 UTC (permalink / raw)
  To: emacs-orgmode


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=linspace(0,1,100);
fc=100;
Ac =1;
C=Ac*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=1;
Am=1
m=Am*cos(2*pi*t); # message signal

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

#+end_src



Thanks,
M

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-babel pass data between blocks
  2014-04-28 12:41 org-babel pass data between blocks Marvin Doyley
@ 2014-04-28 13:07 ` Alan Schmitt
  2014-04-28 14:52   ` Marvin Doyley
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2014-04-28 13:07 UTC (permalink / raw)
  To: Marvin Doyley; +Cc: emacs-orgmode

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=linspace(0,1,100);
> fc=100;
> Ac =1;
> C=Ac*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=1;
> Am=1
> m=Am*cos(2*pi*t); # message signal
>
> z=m*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.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.

Alan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-babel pass data between blocks
  2014-04-28 13:07 ` Alan Schmitt
@ 2014-04-28 14:52   ` Marvin Doyley
  0 siblings, 0 replies; 3+ messages in thread
From: Marvin Doyley @ 2014-04-28 14:52 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

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=linspace(0,1,100);
>> fc=100;
>> Ac =1;
>> C=Ac*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=1;
>> Am=1
>> m=Am*cos(2*pi*t); # message signal
>> 
>> z=m*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.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.
> 
> Alan


[-- Attachment #2: Type: text/html, Size: 2053 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-28 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 12:41 org-babel pass data between blocks Marvin Doyley
2014-04-28 13:07 ` Alan Schmitt
2014-04-28 14:52   ` Marvin Doyley

Code repositories for project(s) associated with this 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).