I am writing a Monte Carlo simulation in which I take "measurements" of the magnetization every 1 correlation time. I want to have 3 for loops. The first is to change the temperature and inside it (with constant temperature) 2 other for loops in which I run e.g 10 correlation times, so 10 measurements of M. My question is, how can I switch the txt file in which I write (with fprintf) M, for different temperatures? Shape of the 3 loops I want