Search code examples
emacsorg-mode

How do I use element-wise operation in org-tables (orgmode)


I have this table, and I want to do the following: For an element a(i,j) of the table, it's value is the product of the last element in the row(i) times the last element in the column(j), divided by the last element in the matrix (i_max,j_max)

What I have tried so far, to get an idea of where I'm at:

Org-mode table


Solution

  • Here is what you need:

    1. @>, or @>$0 refers to the last row, current column.
    2. $>, or @0$> refers to the current row, last column.
    3. @>$> refers to the last cell in the table.

    Documentation here.

    | C1    |        C2 |        C3 |        C4 | 5 | C6   |
    |-------+-----------+-----------+-----------+---+------|
    | sp    | 157.09091 | 264.88201 | 143.30368 |   | 648  |
    | pr    | 72.969697 | 123.03933 | 66.565442 |   | 301  |
    | rs    | 145.93939 | 246.07866 | 133.13088 |   | 602  |
    |-------+-----------+-----------+-----------+---+------|
    | total |       376 |       634 |       343 |   | 1551 |
    #+TBLFM: @5$6=vsum(@I..@II)::@2$2..@4$4=@0$>*@>$0/@>$>