05-05-2022 02:20 AM
Hello, i got this VI in which a simulated temperature reading happens (basically a random function). I need to print every single temperature value generated on a .txt file but, as it is now, it only prints the last one and i cant understand where the problem is. Can anyone help me? Thank you very much
Solved! Go to Solution.
05-05-2022 02:54 AM
Open file function inside your SaveFile.vi has the operation parameter set to "replace or create" which will replace any existing file before writing so you will see only the last value.
05-05-2022 03:39 AM
tried to set it to every other parameter but it still would print just the last value..
05-05-2022 03:47 AM
Have you tried with open or create? Also, input in SaveFile.vi has to be array! You uploaded a broken version of the code:
05-05-2022 04:02 AM
yes, tried with open or create too but it still wont work, i think its more a problem of the code itself but i cant figure out what it is.
Attached the correct version of the code, no idea on why it was broken
05-05-2022 04:12 AM
Set replace or create if you want to replace the file next time you write an array of values to it and open or create if you want to append the values to the file. Also, the WHILE loop inside your SaveFile.vi has no effect, it has to be replaced with a FOR loop. If you opted for open or create you need to set the file position to the end before writing new data:
05-05-2022 04:18 AM
Hi,
in order to add information to text file .
you need to get the last position of your text file and make it your starting position.
Save File : (there is no need of For loop when the the count terminal =1 )
=> if you face issues in the same project (Could you please keep it in one subject).
05-05-2022 05:00 AM
Thank you! Yeah i was missing my last position to add information to the file, it works now! Tysm