LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store information in memory instead of writing files.

Hi.

I currently have a few VI's that I store information in files while the program is running.  When new information becomes available it is written to the file, overwriting the existing file, or appended to the file.  Sometime this needs to be done thousands of times from a loop to create, for example a text file with the info I need.  The reading and then rewriting of the file seems to be inefficient and can often take quite some time.  Is there an easy way to simply store my information and both rewrite it, or append to it, just like you would to a text file?  Any suggestions would be appreciated.  Thanks.

Jeff
0 Kudos
Message 1 of 6
(2,815 Views)
You need to specify a bit more quantitatively what you need. I generally use shift register that I associate with a cluster.
0 Kudos
Message 2 of 6
(2,812 Views)
Thanks for the quick reply.  In one case I build a text file in .001 increments, sometimes as long as 100,000 lines, or up to 100.   Right now I write .01 to a text file and then in a loop, reread that file and append .002 to it, and so on, until I have say .001 to 100 written to the final file, and then exit the loop.  I just wanted to avoid all the writing to files.  Are you saying the shift register will simply store all these values and I can write to a file in the last loop so each line of the text file represents each value from each loop?  In another case, I simply have one value that is periodically updated while the program is running.  To keep track of that information I store it in a text file.  I would rather store that info without a file so the program does not have to rely on writing a file, and run into problems with where the file is written and permissions to that file.  Thanks.

Jeff
0 Kudos
Message 3 of 6
(2,802 Views)
Ok.  I just altered my VI to write one time after all the loops and it worked perfectly.  Thanks for that, I didn't realise that the information from the loop stayed together upon exiting the loop.  As far as the other situation, is there a way to keep values stored while a VI is running for the VI to access at any time without writing a file?
0 Kudos
Message 4 of 6
(2,797 Views)
I tend to be non-purist with regard to data flow. I would create a control or indicator to store the value. Then I would use either a local variable or a reference to read or write the value depending if you have a control or indicator. You will need to adjust the local variable to read or write by right clicking on it and select read or write.
0 Kudos
Message 5 of 6
(2,785 Views)
You can use a Functional Global to store and retrieve your data from memory. (see definition)

You can also add actions to your Functional Global to write the data stored within to a file for logging purposes.


0 Kudos
Message 6 of 6
(2,776 Views)