Hi Steven

On Tue, May 27, 2014 at 11:12 AM, Steven Adrian <sadr...@acumeniacal.com> 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: 
> @1$1..@3$3=getElem([@#,$#],inv(arrange(remote(matrixTable,@1$2..@3$4),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 @1$2..@2$3 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

Reply via email to