LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help - Invalid reference error when closing file

Solved!
Go to solution

The problem is that the 'TDMS Close' function is generating the following error:

-------------------------------------------

Error -2501 Occured at TDMS Close in host pc.vi

Possible Reasons: Invalid TDMS file reference.

------------------------------------------

 

What is so odd about this, as you can see from the screen shot, is that many other functions use the file reference with no problem whatsoever but when it gets to the close function an error is thrown. I have probed out the error wire at every step and there is no error occuring before the close tdms file function.

 

Just to help you understand the function: A temporary tdms file is created and all the data from the raw data file is stored on it. A list is generated of all the valid channel names (channels named something other than " * ") and then these valid channels only are read from the temporary tdms file and written to the final output file. The files are so large the read and write functions need to be placed into for loops so that data is read/written one row/column at a time and the whole 90 mb file isnt being loaded into RAM. 

 

Can anyone help me? I really need to figure out what is going on. Code examples would be helpful. 

Message Edited by rex1030 on 04-24-2009 03:17 PM
---------------------------------
[will work for kudos]
0 Kudos
Message 1 of 22
(5,457 Views)
Solution
Accepted by topic author rex1030

 

 

 

Change all of the tunnels you use for the refnum in those For loops to Shift Registers.

 

If the For loop iterates "0" times the refnum goes invalid.

 

Ben

Message Edited by Ben on 04-24-2009 02:31 PM
Message Edited by Ben on 04-24-2009 02:31 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 22
(5,450 Views)
ooops here you go
---------------------------------
[will work for kudos]
0 Kudos
Message 3 of 22
(5,447 Views)
Darn you are quick. Ok let me test it. Smiley Very Happy
---------------------------------
[will work for kudos]
0 Kudos
Message 4 of 22
(5,438 Views)

rex1030 wrote:
Darn you are quick. Ok let me test it. Smiley Very Happy

 

Just because I posted a link to your image and a reply 3 minutes before the image was posted? Smiley Tongue

 

Pass your error cluster through shift register as well since you could loose error info the same way.

 

have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 22
(5,435 Views)

Hi Ben,

 

I'm having the same problem like this. Could you please make it clear how to solve this problem.

 

Thanks.

 

Firdaus 

0 Kudos
Message 6 of 22
(5,295 Views)

What about my previous reply did you not understand?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 22
(5,286 Views)

"Change all of the tunnels you use for the refnum in those For loops to Shift Registers."

 

I'm not understand with this statement.

 

Attach together is my VI. Thanks.

 

Firdaus

 

0 Kudos
Message 8 of 22
(5,281 Views)

Your case is different but related.

 

You are loosing your file ref because you are using the "Use default if un-wired" option on the output of your case structure.

 

1) Replace the output tunnel of teh while loop with a shift register

 

 

2) Wire through the refernce in all of the other cases.

 

 

Have fun!

 

Ben

Message Edited by Ben on 05-05-2009 07:33 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
Message 9 of 22
(5,263 Views)

Its work!

 

Thanks Ben.

 

Firdaus

0 Kudos
Message 10 of 22
(5,254 Views)