help-octave
[Top][All Lists]
Advanced

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

Re: undefine variable.


From: Hoeltgen Laurent
Subject: Re: undefine variable.
Date: Thu, 2 Aug 2012 09:03:16 +0200

Hi,

2012/8/2 astie darmayantie <address@hidden>

Here i have 2 .m file which are connected. because the first .m file will call for another function in the second .m file.
So here's the mechanism i call a function in the first .m and the first .m will call another function listed in the second .m file to complete the calculation.
The problem is the second .m file can not read the variabel i have defined in the first .m :(
and keep having these error

% here i call a function from the first .m file
[edgelist, labelededgeim]=edgelink(edgeim,10);

warning: nested functions are coerced into subfunctions in file /usr/share/octave/3.6.2/m/image/cleanedgelist.m
error: `edgelist' undefined near line 310 column 17
error: evaluating argument list element number 1
error: evaluating argument list element number 1
error: called from:
error:   /usr/share/octave/3.6.2/m/image/cleanedgelist.m at line 310, column 5
error:   /usr/share/octave/3.6.2/m/image/cleanedgelist.m at line 99, column 61
error:   /usr/share/octave/3.6.2/m/image/edgelink.m at line 128, column 18


i already attach the .m file. i got confused because these code works very well on matlab.

Thankyou


--
Regards,


Astie Darmayantie


_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave


If you want to use a variable defined within a function and this variable was defined somewhere else, you have to pass it as an argument to the function. This is a problem with the scope of your variables.
Btw, are you sure that this code really works in Matlab? To my knowledge this should also fail in Matlab.

Regards,
Laurent

reply via email to

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