help-octave
[Top][All Lists]
Advanced

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

Re: matlab commands what and gcf


From: pkienzle
Subject: Re: matlab commands what and gcf
Date: Tue, 16 Sep 2003 21:04:15 +0100

On 15 Sep 2003 at 9:40, John W. Eaton wrote:

> On 15-Sep-2003, address@hidden <address@hidden> wrote:
> 
> | On 12 Sep 2003 at 16:25, Joerg Schreiber wrote:
> | 
> | > octave:42> what
> | > error: `what' undefined near line 42 column 1
> | 
> | Simple what is easy to write.  ls *.m gives most of it.
> | 
> | 'what path' is more difficult since the file_in_loadpath function 
> | does not return directories.  E.g., file_in_loadpath("general","all")
> | returns the empty string.  The correct approach would be to see
> | if there is something in the kpathsea library shipped with octave
> | which lists all the directories in the load path and search that.
> 
> Octave maintains an internal variable called Vload_path_dir_path.
> This is an object of type dir_path and has a method all_directories
> that returns a string_vector object containing all the directories in
> the loadpath.  This is not the same as just looking at the components
> of LOADPATH and DEFAULT_LOADPATH because some elements of those
> variables may end in // which implies recursive searching.
> 
> I don't think the functionality of dir_path::all_directories is
> exposed to the scripting language level yet, but it would be easy to
> write a function that would return all the directories in a cell
> array.  Should a call to file_in_loadpath with no arguments do this,
> or should we have a new function?

Could file_in_loadpath return directories?  Or if you are worried
about confusing directories and paths, could
        file_in_loadpath([directory,"/"],"all")
return directories?

I would rather file_in_loadpath() not return a list of directories 
since that is too magical.  My rule of thumb is whether or not
the basic functionality can be described in a simple sentence.
"Returns the path(s) of a file in the loadpath, or returns the
directories in the loadpath if no file is specified" seems like
too long a sentence.

- Paul



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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