[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "which" doesn't quite work ?
From: |
Mike Miller |
Subject: |
Re: "which" doesn't quite work ? |
Date: |
Mon, 10 Sep 2012 08:30:35 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sun, Sep 09, 2012 at 03:04:14PM -0700, Sergei Steshenko wrote:
> octave:7> which foo, Sample
> Sample =
> {
> [1,1] = -0.12300
> [1,2] = 0.23400
> }
> octave:8> which Sample, foo
> foo =
> {
> [1,1] = 0.23400
> }
> octave:9>
> ".
>
> Please note that "help which" says "Display the type of each NAME",
> but both "which foo, Sample", "which Sample, foo" display the type of
> just _one_ last item, and not of each name.
See https://www.gnu.org/software/octave/doc/interpreter/Commands.html#Commands
The comma operator here separates commands, not arguments to a function.
Instead try either of:
octave:1> which foo Sample
octave:2> which ("foo", "Sample")
to do what you intended, giving the same results as
> octave:9> which "foo"
> octave:10> which foo
> octave:11> which Sample
> octave:12> which "Sample"
> ",
>
> i.e. if I specify just one name, nothing is displayed.
>
> This is octave-3.6.2.
>
> Is it supposed to be this way ?
Yes. The "which" function operates on functions in Octave's command path
or builtin functions, while the "who" and "whos" functions operate on
variables. For information about names that may be either functions or
variables, use "exist" or "type".
HTH
--
mike