I run similar scripts that write to a log file from 2 terminals.
I tried different string related commands, like int2str, sprintf2, I also made sure the the variable names are different. I can see that the output is getting mixed up into both files. Fragments of the original string could appear in any file.
Using different delays within the scripts to avoid writing at the same time (starting the scripts around the same time) reduces the problem. It looks like all the open consoles are sharing the same memory and overwrite each other. I had the problem in version 4.89, but 4.105 made it much worse.
I run similar scripts that write to a log file from 2 terminals. I tried different string related commands, like int2str, sprintf2, I also made sure the the variable names are different. I can see that the output is getting mixed up into both files. Fragments of the original string could appear in any file. Using different delays within the scripts to avoid writing at the same time (starting the scripts around the same time) reduces the problem. It looks like all the open consoles are sharing the same memory and overwrite each other. I had the problem in version 4.89, but 4.105 made it much worse.