[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: function help
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: function help |
Date: |
Thu, 23 Feb 2012 15:27:40 -0500 |
On 23 February 2012 15:15, Martin Helm <address@hidden> wrote:
> Am 23.02.2012 20:55, schrieb damian.harty:
>> And then it works. I fail at every attempt to combine them into a
>> single file...
>>
>
> Because by design all the additional function definitions in the .m file
> are local and hidden to the outside world. You can of course make them
> visible with function handles like this
That's an ugly an unnecessary Matlab-inspired hack.
In Octave, unlike in Matlab, you can define functions in the
interpreter and in script files.
So you can do something like writing this in func_init.m:
1;
function out = foo(x)
## ...
endfunction
function out = bar(x)
## ...
endfunction
And whenever you write "func_init" both foo and bar functions will be
defined in scope.
Subfunctions are still hidden like in Matlab, but at least you don't
need to be doing uglier function handle hacks to just get a few
functions into scope.
- Jordi G. H.
- function help, Tom Bohdan, 2012/02/23
- Re: function help, Doug Stewart, 2012/02/23
- Re: function help, Ben Abbott, 2012/02/23
- Re: function help, damian.harty, 2012/02/23
- Re: function help, damian.harty, 2012/02/23
- Re: function help, Jordi Gutiérrez Hermoso, 2012/02/23
- Re: function help, Ben Abbott, 2012/02/23
- Re: function help, Ben Abbott, 2012/02/23
- RE: function help, Damian Harty, 2012/02/24
- Re: function help, Doug Stewart, 2012/02/24
- Re: function help, damian.harty, 2012/02/24
- Re: function help, Doug Stewart, 2012/02/24
- Re: function help, Doug Stewart, 2012/02/24