简体   繁体   English

将emacs calc向量插入到组织模式表电子表格中

[英]Inserting an emacs calc vector into an org-mode table spreadsheet

This question concerns the movement of data between cells in an org-mode table spreadsheet and an emacs calc vector. 这个问题涉及组织模式表电子表格和emacs calc向量中单元格之间的数据移动。

I know that data can be pulled from a table and used in a function that takes a calc vector as input: 我知道可以从表中提取数据并将其用于以calc向量作为输入的函数中:

#+TBLFM: @2$4=vmean($2..$6)

I would like to go the other way and take the vector output from a function and write it to a range of cells in the spreadsheet, something like: 我想走另一条路并从函数中获取矢量输出并将其写入电子表格中的一系列单元格,如:

#+TBLFM: @2$1..@2$10=index(10)

(index is aa calc function that returns a calc vector with integers from 1 to n, the input to index) (index是一个calc函数,它返回一个calc向量,整数从1到n,输入到索引)

But the table formula above puts the whole vector in every cell. 但是上面的表格公式将整个矢量放在每个单元格中。 How can I insert the vector elements into a cell range with one vector element per cell? 如何将矢量元素插入到每个单元格中有一个矢量元素的单元格范围内?

Calc has a subscr function that will work: Calc有一个subscr函数可以工作:

Whole vector in one cell: 整个载体在一个细胞中:

| [1, 2, 3, 4, 5] |
#+TBLFM: @1=index(5)

One vector element in each cell: 每个单元格中的一个向量元素:

| 1 | 2 | 3 | 4 | 5 |
#+TBLFM: @1=subscr(index(5),$#)

This works for any calc function or custom calc function that returns a vector. 这适用于任何返回向量的calc函数或自定义calc函数。

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

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