help-octave
[Top][All Lists]
Advanced

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

Re: Editing files, indexing operations...


From: Paul Kienzle
Subject: Re: Editing files, indexing operations...
Date: Tue, 24 Dec 2002 00:02:22 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2.1) Gecko/20021130

James Frye wrote:

On Mon, 23 Dec 2002, John W. Eaton wrote:

Why not just fix things so that Octave is compatible with Matlab?

Well, that would certainly be my preference :-)  Then the programs I have,
which do work in Matlab, would also work in octave without me having to
fiddle around with them at all, and I could get back to what I'm supposed
to be doing.  And if you could have it done sometime in the next few days,
please :-)

However, the message I got was that octave wouldn't allow a whole program
(or multiple functions) to be packaged in one file, with the implication
that this WAS a case of octave doing something better than Matlab.
That certainly wasn't my intent.

Which
would seem to leave me SOL as far as using octave: I could introduce minor
fixes such as the end in array index stuff without anyone complaining, but
if I did something as major as breaking all the scripts into multiple
files, the people around here would like me a lot less than they
do now :-)

If you automate the process, you only have to break the scripts into multiple files for the purpose of running octave. Put it in a Makefile, and have it spit the split files out to a separate directory which is in the octave path but not the matlab path. You have one extra step after saving the file, which isn't so bad in the short term. This script should be easy enough for someone familiar with perl. Any
volunteers?

While you are at it, you can collect all the functions in the .private subdirectory, tag them with the directory name of the parent, copy them to your octave path, and modify all the files in octave path so that any identifier which matches the name of a file in the .private directory is replaced with a tagged version of the identifier. Even if the identifier is a variable instead of a function name, the
tagged version will still work.

There is some special pragmas for marking functions as commands in the latest CVS. Some matlab code depends on this. Running a special script in the directory creates a PKGADD file which gets executed when the directory is first added to your path. I don't know what happens if you change the contents of PKGADD in the middle of the session. I suppose you would have to reexecute it with something like source(fille_in_loadpath('package/PKGADD')).

Long term we should have a way to handle functions which are private to a file and those that are private to a package. I'm not so keen on multiple levels of nesting --- pascal had it, but it never did much for me. Of course, that was first year and projects were smaller, but even now I get along just fine with functions that are private to a file in C. I also don't see a convenient syntax for multiple levels of nesting. The current matlab syntax doesn't separate the multiple functions in the file with end statements, so if octave had multi-level nesting only the first sub function would be visible to the main function. I don't know the semantics of scope within matlab, but I'm guessing that you can call any function within a single m-file from within any other function defined in
the same file.

Paul Kienzle
address@hidden




-------------------------------------------------------------
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]