繁体   English   中英

组织模式,源代码块,结果向量

[英]org-mode, source code block, result vector

在 org-mode to beamer 演示中,我想使用pythonR源代码块处理来自电子表格的数据。 我知道该怎么做。

会有一个结果向量,我需要在不同的幻灯片上获取单独的向量元素。 有没有办法对结果向量进行解构,这样就不用每次都重新计算电子表格了? 也许让python只将向量存储为变量,然后使用内联python调用来提取值?

例子:

#+name: calculation
#+begin_src python :result value
return [1, 2, 3]
#+end_src

*** Slide one
I calculated <how to insert :calculationresult[0]>?
- some 
- content

*** Slide two
I calculated <how to insert :calculationresult[1]>?
- more
- content

只是玩弄文档和 SO,我找到了以下解决方案:

  • 在会话模式下计算代码块内的结果
  • 在使用相同会话的内联代码调用中提取结果
#+name: calc
#+begin_src python :session :results output :exports none
  myvec = [1, 2, 3]
#+end_src

#+RESULTS: calc


* Page 1

I got number src_python[:session]{myvec[1]}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM