Ansys Learning Forum › Forums › Discuss Simulation › Preprocessing › About the selection of odd and even numbers through *IF and *DO loop › Reply To: About the selection of odd and even numbers through *IF and *DO loop
February 21, 2022 at 9:44 pm
Ansys Employee
There are probably multiple approaches that will work. One approach might be to use the MOD(x,y) function. to find the remainder. Something like:
x1 = mod(ii,2) ! place immediately after *DO command
If ii is an even number; then x1 would be equal to zero
If ii is an odd number, then x1 would be equal to 1
You can then use x1 in the *IF statements
x1 = mod(ii,2) ! place immediately after *DO command
If ii is an even number; then x1 would be equal to zero
If ii is an odd number, then x1 would be equal to 1
You can then use x1 in the *IF statements