Login  Register

User-defined functions in macro

Posted by AAM71 on Dec 04, 2018; 10:31pm
URL: http://imagej.273.s1.nabble.com/User-defined-functions-in-macro-tp5021531.html

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.
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