help-octave
[Top][All Lists]
Advanced

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

Re: A suggestion about the code


From: Nicholas Jankowski
Subject: Re: A suggestion about the code
Date: Fri, 22 May 2015 19:44:26 -0400

What you're referring to, sub functions in scripts, has been the subject of much debate in the MATLAB community. For whatever reason, they have elected to disallow functions in scripts.

While Octave sets matlab compatibility as a goal, they do allow subfunctions to be defined in the scripts that use them. I found out the hard way that this is not MATLAB compatible, as I do like the convention over a mess of separate files.

I also found that for no discernable reason, octave's implementation of this seems not perfect (surely the errors weren't my fault :) ). I've had scripts unable to find functions for no good reason until closing and restarting Octave, at which point it would be fine. Sometimes adding a single commented line to a script would render a subfunction 'unfindable' and deleting it would fix things...

I never got around to putting a simple test together to isolate the problem, I wound up just putting them in separate files for MATLAB compatibility.  maybe i'll try to get back to it to see what the problem was and of its bug report worthy.

Nick j.

On May 22, 2015 5:50 PM, "Criptos" <address@hidden> wrote:
Hi!
I have programmed in Fortran and in Matlab (and obviously in Octave) and
I thought that there could be a small change in the way this programme
uses the functions. In Matlab (and in Octave too) functions must be
defined in a separate script, which can be a problem if you use many
functions and you save them in different folders. But Fortran has a
different problem: you have to define the functions in the same script
in which you are going to use them.
With these things in mind I came up with a simple solution that could be
applied to Octave: make possible for the user to declare the function in
the script in which it is going to be used and not necessarily to be in
a different script.
It is my suggestion for improving this project a bit.

Thanks for your attention

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave

reply via email to

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