help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "which" doesn't quite work ?


From: Sergei Steshenko
Subject: Re: "which" doesn't quite work ?
Date: Mon, 10 Sep 2012 13:28:34 -0700 (PDT)


--- On Mon, 9/10/12, Mike Miller <address@hidden> wrote:

> From: Mike Miller <address@hidden>
> Subject: Re: "which" doesn't quite work ?
> To: "Sergei Steshenko" <address@hidden>
> Cc: "Octave users list" <address@hidden>
> Date: Monday, September 10, 2012, 5:30 AM
> 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
> 

"HTH" - alas, it doesn't help.

"The "which" function operates on functions in Octave's command path or builtin 
functions" - this statement is incomplete. In my original Email I did post 
output of 'help which' and in it one can see:

"
 -- Command:  which name ...
     Display the type of each NAME.  If NAME is defined from a function
     file, the full name of the file is also displayed.
"
, i.e. 'which' _also_ works on functions, and in case of functions it displays 
info different from the case of non-functions.

Earlier in this thread it was shown that 'which foo' works in Matlab for 
non-function 'foo'.


Regards,
  Sergei.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]