04-14-2016 08:34 AM
2012 is what I am using. That VI crashes my instance of Labview.
04-14-2016 08:43 AM
How about this copy?
04-14-2016 09:41 AM
That one works. Lots of things to talk about:
When does the end user have the error popup? And what does appendFile.vi do? I can see a potential confict in the Stop event where the file path is used in two places at once. There could be a write to the file for "Last Minutes" as well as in appendFile.VI. You can create a dependency by doing the following:
Now for some cleanup:
And that's just getting started.....
04-14-2016 10:04 AM
Wow, thank you!
Okay, so let me explain the purpose of my code. I am monitoring 3 boards. The data is typically recording logarithmically because we don't know how long the experiment will run for. If I am measuring something for a 1000 hours, I don't want to record the current every second. It will record it every 1s, 10s, 100s, etc. BUT I created a queue that records in one second steps for X minutes. So if the device fails, it will append that data to the file so I can see what was going on momemnts before the device failed. Maybe not the most efficient way, but it was working for us.
I recently added the text messaging notification. Now, I really don't think it has anything to do with this new error, but I clearly changed something and I am getting this error. The error is happening under "Start". The user has not pushed "Stop" and the device has not failed either.
I am definitely going to update my code and do your suggestions. I don't often write in LabView, so when I get back to it, it is really confusing to debug 😛 Anyhow, it will be a work in progress.
For the time being, I am thinking of doing your suggestion earlier by opening a file once, writing to it, and at the end closing it. Do you recomend doing this with a spreadsheet or text file? The write to text file function accepts string and arrays. Can it accept 2D arrays? This would be useful for me for the "last minutes" thing.
04-14-2016 10:24 AM
A common misconception with the Write to Spreadsheet File VI is that the file is not actually an Excel spreadsheet. It is writing a CSV (comma separated values) text file, which most people will add an XLS extension to the file name and it will open up perfectly in Excel and you would be none the wiser....unless you actually open the file with a text editor.
Basically you want to use the Array to Spreadsheet String function found on the string palette and write this to the text file. File permissions should be set to open or create.
04-14-2016 10:38 AM
I can give you another tip that will drastically clean up your block diagram. rather than enqueuing one string into multiple queues, why not create a cluster datatype for the queue and then you only need one, rather than 6.
04-14-2016 11:25 AM
Thank you again.
So I am creating a new file (under Load) and adding a header file to the top of the file with the text file options you suggested. Initially I added it to the Header File subVI and it prompted me to select a save path, and a text file was created with the header. But when I add it to my main program where the user input the savepath and clicks load, a text file with only comas is added, no data?
I feel like it is staring me right in the face...
Ah and now it won't allowe me to save to a previous version, I took a screenshot...
04-14-2016 11:40 AM - edited 04-14-2016 11:42 AM
With the current lack of structure in the architecture, I would open the file outside of your main loop, remove the shift register and use this file reference wherever it is needed. Be sure and close the reference in the Stop case after you have finished all of the file writes.
This won't work as it requires the path to be selected before the program starts.
04-14-2016 11:51 AM
Sorry, I am not sure what to do now. I don't mind having a prompt come up for the user to select where to save it instead of it being in the main interface. Once that path is created, can I use that as a shift register?
04-14-2016 01:37 PM
You don't need to use a shift register. That's why I deleted it. The problem with shift registers is you have to write a value to them or you lose the value. They are perfectly ok to use but don't overuse them if they are not necessary because they can create a lot of unnecessary wiring.
If you're ok with prompting the user at the startup of the application, replace the file path control with a file dialog. Now everywhere you need to write to the file, drop a Write Text file and wire in this reference. and then close the reference in the Stop state.