[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Insert calc vector directly into spreadsheet cells?
From: |
Michael Brand |
Subject: |
Re: [O] Insert calc vector directly into spreadsheet cells? |
Date: |
Tue, 27 May 2014 20:06:54 +0200 |
Hi Steven
On Tue, May 27, 2014 at 11:12 AM, Steven Adrian <address@hidden> wrote:
> Here is the custom calc function that is similar to subscr. It will
> work for both vectors and matrices:
>
> (defmath getElem (indices m)
> (let (i j)
> (if (vectorp indices)
> (progn
> (setq i (cadr indices))
> (setq j (nth 2 indices))
> (nth j (nth i m))
> )
> (progn
> (setq i indices)
> (nth i m)
> )
> )
> )
> )
>
> Here is the table function to get matrix data from a table, take the
> inverse, and write the result to a new table:
>
> #+TBLFM:
> @address@hidden(address@hidden,$#],inv(arrange(remote(matrixTable,@address@hidden),3))
Very nice. I didn't know the Calc function arrange([a, b, c, d], 2) to
get [[a, b], [c, d]]. I always thought that when a TBLFM range spans
more than one row and column like in @address@hidden it should learn to
result in [[a, b], [c, d]] instead of the current [a, b, c, d]. Thanks
for showing how to deal with this.
Michael