LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 5

Solved!
Go to solution

Hi all,

 

I have written some code which monitors three digital multimeters and appends the data to a csv file.  Users of my code were telling me that they were getting this error (attached), and then they would click continue and it would start recording again data again.  This happened twice.  I tried recreating the problem by opening the file and it happened (obviously).  It would not let me continue until I closed the file, of course.  However, the other users said that they did not have to close any file and that no file was ever opened.  I am not sure how long the error message was open for when they were running the code.

 

Are there any ideas why this might happen other than the file being open?

 

I attached the error message.  In my code, I write a header file using the Write to Spreadsheet.VI and as it is recording data, I am just appending to the spreasheet using  the save VI.  I took a picture of where it is being appeneded to rather than attaching my project (it is really big), but if you need to see more, let me know.

 

Thank you!

 

 

Download All
0 Kudos
Message 1 of 22
(5,025 Views)

Sorry Natalie but I become cross-eyed when looking at that code.  Smiley Very Happy I suggest you investigate some sort of architecture for your program (i.e. state machine) to help facilitate readability and debugging. 

 

The error says it all.  Do you open the file in another section of the code in order to read in the data or analyze it in some way? 

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 2 of 22
(4,999 Views)

Haha, I was afraid that might happen.  Don't worry- I can read it.  

 

No, it isn't being opened anywhere else.

0 Kudos
Message 3 of 22
(4,994 Views)

You can read it because you designed it.  However, you are currently asking outsiders to interpret what only you can understand.  You won't always be the only one to look at a piece of code so keep that in mind.  One suggestion that would make a big difference is to bundle those outputs from the Measure VI into a cluster within the subVI itself.  Then you only need a couple of terminals, which cleans up the code and when you unbundle the cluster, you get understandable names, not just a jumble of spaghetti wires.  

 

Pictures are hard to debug and without seeing the rest of the code, I would have to say that it is being opened somewhere else, either by the application or by the user within the operating system (Excel, a different Labview EXE, etc).  

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 4 of 22
(4,984 Views)

Here's an example.  Which of these is easier to read and understand?

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 5 of 22
(4,972 Views)
Solution
Accepted by _natalie_

Natalie,

 

You might also try using the basic text file tools rather than the spreadsheet file VI.  For each call to this particular VI, it opens the file reference, appends the data, and closes the file.  If you are writing many samples very quickly, the better solution would be to open the file once, write to it as needed and then close the file when finished.  This would guarantee that your code has sole access to the file.  

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

Thanks, aputman.  I have started using clusters.  There are some in my code.

 

I have attached my program.  I realize pictures are hard to debug, but I thought there might be something obvious or missing with how I might be implementing my Write to Spreadsheet VI.  That's why I attached a picture instead of asking someone to look through all my code.

 

However, I will attach it now although it will be hard to follow.  I am using that VI under in a case structure under "Load", in another case structure under "Start" and  under "Stop".  Load is there to setup meters, timing, etc.  Play is there to measure and record the data.  Depending on how the user specifies the logging intervals, it will append it every X seconds.  If the user specified logarthmic timing, then it will record every 1s, 10s, etc.  When the user pushes stop, it will append the last X minutes (this is measured every second in a queue) to the file.  The idea behind this was to record what was going on just before something failed.

 

 

0 Kudos
Message 7 of 22
(4,950 Views)

I might just have to consider that!

 

Thank you also for showing me the different examples.  I will start doing that from now on.  Unfortunately, I can't update it right this second.

0 Kudos
Message 8 of 22
(4,947 Views)

Curse you, Labview 2012.  Smiley Mad  Sorry, I can't open the file unless you can downsave it.

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 9 of 22
(4,942 Views)

Ah sorry, I didn't see this until now.

 

I just saved it to LabView 8.0.  Will that work for you?

0 Kudos
Message 10 of 22
(4,900 Views)