Page 1 of 1

Making threshold for variables in makro

Posted: Sun Dec 30, 2012 3:32 am
by morten
I want to make a cut off for some data in tecplot.
In macros I can call this data by {O} when e.g. using the alterdata command.

I want to set {O} to zero when it is below a given threeshold, say 0.05.

I have tried

$!IF {O}<0.05

but the first line is not accepted.

Thus, my problem at the moment is, that I don't know how to make if statements for the data, only for variables with a single value defined in the macro.

Any help would be greatly appreciated.

Re: Making threshold for variables in makro

Posted: Wed Jan 02, 2013 10:30 am
by Chris Idso

Tecplot's macro language does have an IF statement, but it only works on variables that are declared within the macro, using the VARSET statement.

You can access the data you have loaded into Tecplot from the macro language, but you have to do it using function calls. Specifically, you can fetch a value of a variable for a given zone using the GETFIELDVALUE function, and you can set a value of a variable in a given zone using the SETFIELDVALUE function.

You would need to check all of the values of the desired variable in a given zone, and there is no way to check them all at once, so you will need to cycle through all the values for the desired variable in the desired zone one at a time in a loop (the macro language has LOOP and ENDLOOP statements). You can use the GETFIELDVALUE and SETFIELDVALUE statements within the loop to fetch each value and then reset it if you need to.

Re: Making threshold for variables in makro

Posted: Thu Jan 03, 2013 1:37 pm
by Chris Idso

You can find the syntax for the GETFIELDVALUE and SETFIELDVALUE commands in Tecplot Reference Manual which is in the Doc folder within your Tecplot folder. The reference manual filename is tprm.pdf.