> On Dec 4, 2018, at 5:31 PM, Aleksandr Mironov <

[hidden email]> wrote:

>

> Dear Listers,

>

> I think I have rather limited understanding of how user-defined functions are working and need some help.

> My macro should have procedure function and initialization function to set up parameters for the procedure.

Use ‘var’ statements to declare global variables, for example:

var x, y;

init(1,2);

type();

function init(x1,y1) {

x=x1;

y=y1;

}

function type() {

print(x,y);

}

-wayne

> I have tried to do this in the following way (just simplification):

>

> x1=1;

> y1=2;

>

> Init(x1,y1);

> Type(x,y);

>

> function Init(x1,y1) {

> x=x1;

> y=y1;

> }

>

> function Type(x,y) {

> print(x,y);

> }

> ------

>

> But I got the error "undefined variable in line 5", which is "x" in function "Type".

> I am definitely doing something wrong, but do not understand what.

>

> Sincerely,

> Alex

--

ImageJ mailing list:

http://imagej.nih.gov/ij/list.html