11-21-2012 04:02 AM
I have a VI (please see attached) that log data and write it to a measurement file when it is between two values for more than one hour. After one hour it will keep writing the data to a measurement file if still stable.
What I want to do now and what I can not figure out how to is;
When the signal is not stable anymore, it will reset the index of the array to zero and overwrite all data from the previous hours when it was still stable. How can I make sure the index will not be set to zero but will reset to the last stable index point?
I have to append the new stable data block (more than 1h between two values) to the old stable data block. And this for several block’s, depending of the instability of the data.
Thank you for helping me out. I hope my question is clear.
11-21-2012 04:32 AM - edited 11-21-2012 04:34 AM
Your use case would be better served by using a state machine. This will enable you to write the collected data immediately after the time has elapsed, and then write each new succeeding value to the file (using Append) while it remains stable. Currently you are overwriting the entire file each time with all the old data and only one more piece of new data, very inefficient. The state machine will also help take care of the case when the data goes out of limits.
Also, you don't have the file path wired to the Write to Spreadsheet File VI which will give you a file dialog prompt for every iteration!
11-21-2012 05:27 AM
Thank you for the feedback.
I will try to use a state machine, alltough I never worked with it. But I can imagine this will be more efficient.
11-21-2012 01:42 PM
There are examples both here in the forum, on the NI website and in LabVIEW itself.