define statements

Hi supporters,

I would like to know if it is possible to link a define statement with a variable? Here is a small piece of code that makes it more clear:
[SIZE=3]AnyVar[/SIZE] X = iffun (gtfun (Main.MyModel.lin.Pos[0] , 0) , 1, 0);

[SIZE=3]#define[/SIZE] DUMMY X

[SIZE=3]#if[/SIZE] DUMMY == 1

[SIZE=3]AnyOutputFun[/SIZE] True = { Val = Main.MyModel.Seg.r[0];};

[SIZE=3]AnyOutputFun[/SIZE] False = { Val = Main.MyModel.Seg.r[2];};

[SIZE=3][SIZE=2][COLOR=black]So the variable X becomes 1 or 0, depending on the iffun/gtfun formulation. The point is that the output should be created dynamically and automatically. If a value is bigger or smaller than a certain threshold, output A, if not, output B.[/SIZE][/COLOR][/SIZE]

The error I get within this formulation is “X: unexpected” at #define DUMMY X .

[SIZE=3][SIZE=2][COLOR=black]Thanks for your help,[/SIZE][/COLOR][/SIZE]
[SIZE=3][SIZE=2][COLOR=black]Best regards,[/SIZE][/COLOR][/SIZE]

Hi Alex,

Unfortunatly this is not possible. The #define and #if statement are prepocesor, that means they are evaluated once and for all at the begening of the loading before the iffun function. So a dynamic use of those statement during the simulation is not possible in general, they are static switches set at load time.

Best regards, Sylvain.