簡體   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