LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Print SubVI not working properly

Solved!
Go to solution

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

0 Kudos
Message 1 of 8
(1,209 Views)

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.

Lucian
CLA
0 Kudos
Message 2 of 8
(1,196 Views)

tried to set it to every other parameter but it still would print just the last value..

0 Kudos
Message 3 of 8
(1,176 Views)

Have you tried with open or create? Also, input in SaveFile.vi has to be array! You uploaded a broken version of the code:

LucianM_0-1651740431326.png

 

Lucian
CLA
0 Kudos
Message 4 of 8
(1,169 Views)

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

0 Kudos
Message 5 of 8
(1,161 Views)

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:

LucianM_0-1651741858944.png

 

 

Lucian
CLA
Message 6 of 8
(1,151 Views)
Solution
Accepted by topic author domcorrado

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).

 

Emna20_1-1651741817236.png

Emna20_2-1651742185926.png

 

 

Message 7 of 8
(1,146 Views)

Thank you! Yeah i was missing my last position to add information to the file, it works now! Tysm

0 Kudos
Message 8 of 8
(1,122 Views)