LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 5

Solved!
Go to solution

2012 is what I am using.  That VI crashes my instance of Labview.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 11 of 22
(1,342 Views)

How about this copy?

0 Kudos
Message 12 of 22
(1,336 Views)

That one works.  Lots of things to talk about:  Smiley Wink

 

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:

Capture.JPG

 

Now for some cleanup:

  1. There is no need to have all of those shift registers with queue references passed around.  The queue reference doesn't change between loop iterations.  In other words, once you enqueue or dequeue an element, there is no need to pass it back to the beginning of the loop.  
  2. What's up with all the error wires running all thru the program?  If you aren't going to do anything with the errors except display them at the end of execution, you're wasting your time putting them on the diagram.  You can use error wires to repeat commands if you encounter errors.  You can use error wires to enforce dataflow by creating dependencies between your VIs.  But don't just use them to for the sake of using them, if that makes sense.
  3. If your block diagram is larger than one screen, you are doing something wrong.  This code should take up about 1/4 of my screen space.  
  4. Build your file path once outside of the loop and then use it as many times as necessary, again without passing it back thru a shift register (not necessary)

And that's just getting started.....

 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 13 of 22
(1,322 Views)

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.

0 Kudos
Message 14 of 22
(1,311 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 15 of 22
(1,303 Views)

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.  

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 16 of 22
(1,295 Views)

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

 

 

0 Kudos
Message 17 of 22
(1,284 Views)

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.  

 

Capture.JPG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 18 of 22
(1,278 Views)

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?

0 Kudos
Message 19 of 22
(1,272 Views)

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.

Capture.JPG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 20 of 22
(1,257 Views)