06-03-2016 09:29 AM
Hi,
I have a Labview program that contains a while loop in which a file is created every time the loop runs. The file is created at the beginning of the loop, and closed at the end of the loop, after some data is written on it. The file created are .raw pictures, and they are about 2.8mb each.
The program runs fine at the beginning and creates the first file without any problem, and then goes on to create the second file and writes in it. Everything goes well until it tries to close the second file with the Close File function. Then, it just completely freezes. There is no error, nothing. It just stops and stay there for as long as I don't force-stop the program myself.
I searched on the internet, and found that maybe the creation and closing of a file at every loop is too much for LabVIEW and it causes it to crash, but I don't really know how to change that since I have to create a new file everytime.
I can't really attach the .vi file to this message since there is about 15 subvis that it needs to run, but I attached a screenshot of the section that causes problem if it can be of any help.
Maybe there would be another way of coding the labView program so it bypasses this problem?
Thanks
Solved! Go to Solution.
06-03-2016 09:42 AM - edited 06-03-2016 09:48 AM
I don't see any issue with the file aspects of your VI.
What I see that might be the problem is that you have an event structure buried in the VI. Your innermost For Loop is going to pause on every loop iteration unless you cause an event that is handled by that structure to happen. The only event shown in your picture (there might be other events but we can't see them) is the Rotation Go boolean contol needs to be changed in order for the event to fire and the For Loop to finish and start the next iteration.
Are you hitting the Rotation Go boolean on every iteration? Of course if you hit that button and make it go True, the way it is wired will stop both of your For Loops and your inner most code will never repeat.
(Tip: You can simplify the code where you build up your file name by using a Format Into String function. All the string constants get built into the format string. And all the functions to format the numbers get formatted by the format string as well. 6 nodes and 16 constants will get reduced to 1 node and 1 constant with a corresponding decrease in the number of wires.)
06-03-2016 09:45 AM
I'm the Chief Complainer, but I hate pictures of Block Diagrams -- I can't see them clearly, I can't see the "rest of the code", I can't see the other Cases of Case Statements, I can't type ^H on a function I don't recognize to "get LabVIEW Help", and I can't execute it to see where the errors occur.
Please attach your VI, instead. Use the "Attachment" button on the left below this window. Note you can only attach a few VIs -- if you need to attach more, compress a folder containing them and attach the resulting .zip file.
Having said that, what might be happening is a "clash" between closing a file and opening the next one. I've seen this, on occasion, usually when using Excel, and solve it by putting a delay after the Close File (start by putting in a 1 second delay -- if you still get the crash, then this is not the problem).
Do attach your code, however, as it might be "something else" that we might be able to help you discover.
Bob Schor
06-03-2016 10:33 AM
@Bob_Schor wrote:I'm the Chief Complainer, but I hate pictures of Block Diagrams -- I can't see them clearly, I can't see the "rest of the code", I can't see the other Cases of Case Statements, I can't type ^H on a function I don't recognize to "get LabVIEW Help", and I can't execute it to see where the errors occur.
Please attach your VI, instead. Use the "Attachment" button on the left below this window. Note you can only attach a few VIs -- if you need to attach more, compress a folder containing them and attach the resulting .zip file.
Having said that, what might be happening is a "clash" between closing a file and opening the next one. I've seen this, on occasion, usually when using Excel, and solve it by putting a delay after the Close File (start by putting in a 1 second delay -- if you still get the crash, then this is not the problem).
Do attach your code, however, as it might be "something else" that we might be able to help you discover.
Bob Schor
Correction:
You might be the loudest complainer. There's a difference. 😉
06-03-2016 10:37 AM
Thanks, that was the problem! I completely deleted that last frame since it wasn't really necessary, and it know works like a charm! LabVIEW wasn't freezing, it was just waiting for the Rotation Go boolean 😛
Thank you very much for your help and that very fast answer!
06-03-2016 10:42 AM - edited 06-03-2016 11:12 AM
As has been said, We need to see the VI, not a picture.
Overall, the code is way too complicated and convoluted. For example....
06-03-2016 01:20 PM
@Bob_Schor wrote:I'm the Chief Complainer, but I hate pictures of Block Diagrams
Yet another chance for me to use this:
That image is a link describing what is a snippet, and how it can be used to upload pictures which have executable code in them.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-03-2016 02:51 PM
Thanks, Billko and Hooovahh, for the "votes of confidence".
Bob "Am I Really That Loud?" Schor