LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI logs to file but empties the file when stoped

Solved!
Go to solution

I have a VI that creates colum headdings and then updates the rows with data every second, if i open the file while the VI is running all my data is there but if i stop the VI then open the file only my colum headdings are there.

 

I assume it isnt finalising or saving the file when the program stops but i can't figure it out.

 

Any ideas - i have attached a picture...

 

 

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

Excuse me for saying so, but that is one of the ugliest block diagrams I have seen in a while.

 

I suspect your problem is because you have nothing wired in the false case and the shift registers are getting cleared when the case is false. I don't know why you are using the shift registers (and using them badly) anyway. In the true case, it looks like all you need to do is have a single Build Array function, pass it all of the numerics, and pass the 1D array output to the Write to Spreadsheet 1D input.

Message 2 of 8
(3,164 Views)

Thank's for the reply (i think ) i tried passing my numbers into a 1D array then passing that to the 1D write to spreadsheed function. but no matter what i did with the loops it allways filled the spread sheet with copys of the first values that went into the array. It was as if the array simply stored the first values then wrote them to file every second instead of updating the array every second.

 

All i want to do is have a row of values that update every second and are added to a new row on a spread sheet every second.

 

Cheers, Zac

0 Kudos
Message 3 of 8
(3,157 Views)
Well, you'll get an awfull lot of repeats in the file because you would seem to need to update the front panel controls manually. Why don't you just post the VI instead of a somewhat hard to read image.
Message 4 of 8
(3,146 Views)

The front pannel controls are linked to connectors on the VI so they are controled by a master VI.  (i know i should use references instead of actual controls but i wated to be able to change them manually in the VI to help with debugging untill i get the file write working properly.)

 

I have attached the SubVI, but i have made changes to it since i posted the picture. Thanks Zac

0 Kudos
Message 5 of 8
(3,130 Views)
Solution
Accepted by topic author Zac_Acal

I wish I had known you were using this as a subVI because now your problem makes sense. You have a basic misunderstanding of LabVIEW and dataflow. Because you used controls and not references, the controls in the subVI are only updated when your main VI calls this subVI. The values remain the same until the subVI is stopped and called again by the main.

 

It would make more sense to have your subVI just do the write of data - no loop or anything else. Have the 1 second loop in your main as well as a single instance of creating the header.

Message 6 of 8
(3,122 Views)

Ahh, that explains it.

 

I will change them to references.

 

I avoided putiting the loop in my main program as it is quite large on the diagram.  But i can put it there if thats where it should be.

 

Thanks for your help ,Zac

0 Kudos
Message 7 of 8
(3,116 Views)
If you use references, then you can leave the loop. Your subVI and overall program will not be as efficient though.
0 Kudos
Message 8 of 8
(3,113 Views)