I’ve written a function which outputs two variables and takes in 4. It follows the form of my example below. I’m using it as a function block in scilab.
[y1, y2] = myFunc(h,c,V,I)
delta = h - c
omega = V * I
y1 = delta - omega
y2 = omega - delta
endfunction
I can follow through the dialogues to include it in the xcos diagram, but when I exec it before running the simulation it errors by telling me that “h - c” is an undefined variable.
I’m not sure if this is something to do with my basic syntax (I’ve followed a dozen examples and it doesn’t do anything different that I can see) or if it’s because I’m declaring a temporary variable inline (delta). I had the same issue with a longer formula within the function (in the form y2 = (axx)-(bzz) and I ended up having to break it down into:
i1=axx
i2=bzz
y2=i1-i2
or I had the same error. Seems like something fundamental that I have missed/misinterpreted.
Halp