We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation General Mechanical How to write an array to text file ? Reply To: How to write an array to text file ?

Claudio Pedrazzi
Subscriber

Concerning the question about getting the maximum value, if I understand correctly, the problem is that everytime you go through the loop, you overwrite my_energy.  I would simply use an additional storage variable like max_my_energy and initialise it to 0 before the loop begins, then in every step you should simply compare my_energy with the maximum until there, and if higher, substitute it.  

*IF,my_energy,GT,max_my_energy,THEN

max_my_energy=my_energy

*ENDIF