emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Steven Adrian <sadrian@acumeniacal.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Insert calc vector directly into spreadsheet cells?
Date: Tue, 27 May 2014 20:06:54 +0200	[thread overview]
Message-ID: <CALn3zogTJQBEQfDPquRRBbtzqWMVvB-xnDAYW85qMGpPjWcU=Q@mail.gmail.com> (raw)
In-Reply-To: <94E4DBCE-2BEF-4766-A49F-D20DCE9ABB29@acumeniacal.com>

Hi Steven

On Tue, May 27, 2014 at 11:12 AM, Steven Adrian <sadrian@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	other threads:[~2014-05-27 18:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17 21:40 Insert calc vector directly into spreadsheet cells? Steven Adrian
2014-05-20 15:23 ` Bastien
2014-05-21  7:29   ` Michael Brand
2014-05-26 19:39     ` Steven Adrian
2014-05-26 20:43       ` Michael Brand
2014-05-27  9:12         ` Steven Adrian
2014-05-27 18:06           ` Michael Brand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALn3zogTJQBEQfDPquRRBbtzqWMVvB-xnDAYW85qMGpPjWcU=Q@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sadrian@acumeniacal.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).