help-octave
[Top][All Lists]
Advanced

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

Re: Functions in Octave


From: James Sherman Jr.
Subject: Re: Functions in Octave
Date: Thu, 27 Aug 2015 13:27:22 -0400

On Thu, Aug 27, 2015 at 12:58 PM, fbarbuto <address@hidden> wrote:
> The way Octave works puzzles me sometimes.
>
> The very simple, proof-of-concept testfun.m calls two functions and it
> works.
>
> Source2.m also calls two functions, but doesn't work. I get the following
> error message:
>
> *error: 'BporLinhas' undefined near line 54 column 20
> error: called from
>     Source2 at line 54 column 18
> *
> The more I examine their structures, the less I understand why one code runs
> fine whereas the other doesn't.
>
> Source2.m was ported from Matlab, where it /does/ work.
>
> What's the problem?
>
> Fausto
>
> testefun.m <http://octave.1599824.n4.nabble.com/file/n4672321/testefun.m>
>
> Source2.m <http://octave.1599824.n4.nabble.com/file/n4672321/Source2.m>
>
>
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/Functions-in-Octave-tp4672321.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave

I just tried your Source2.m file in Matlab, and I got the following error:

>> source2
Error: File: source2.m Line: 87 Column: 1
Function definition is misplaced or improperly nested.

Which I expected, since I didn't think that Matlab supported multiple
function definitions in the same file.  Are you sure that your
Source2.m, as written, works in Matlab?  If you write each of your
functions in separate files named BporLinhas.m and BporColunas.m and
then run your Source2.m function (in Octave), what happens then?  Make
sure that either your current directory is the same directory as the
three files, or that the path contains that directory.

Hope this helps,

James Sherman



reply via email to

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