LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Binary File Doesn't work from SubVI

Okay, this is a first for me.  The Read from Binary File VI is only working when run from my base VI, and never when I place it in a SubVI.  It always returns error 1.  I've tried creating different SubVIs, and the error is the same.  The only VI that returns an error is the Read from Binary File VI.  The others will work from the SubVI.

 

I've included pictures because the VI has a ton of other project VIs, and the project is huge. I was also afraid that boxing up the portion of code for a dummy VI would warp the results of the problem I'm having.

 

This is LabView 2016.

 

This is the SubVI that does not work.This is the SubVI that does not work.This is my probe results for the SubVIThis is my probe results for the SubVIThis code works perfectly fine even though it's just a copy-paste from the SubVIThis code works perfectly fine even though it's just a copy-paste from the SubVIHere's the probe results when not run from the SubVIHere's the probe results when not run from the SubVI

Doe anyone have any clue what I could try from here? 

 

Thanks.

0 Kudos
Message 1 of 21
(3,680 Views)

What do you get if you probe the reference out of the Read Binary File?  I am just curious if the reference is still valid there since that is generally what causes error code 1.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 21
(3,669 Views)

EDIT: Apologies I misread the question and assumed it was the WRITE that wasn't working!

0 Kudos
Message 3 of 21
(3,662 Views)

@crossrulz wrote:

What do you get if you probe the reference out of the Read Binary File?  I am just curious if the reference is still valid there since that is generally what causes error code 1.


The reference is the same and still valid.  I can delete the error, and nothing else causes any error with that same reference.

 

Basically, using the same reference, the next write does not create an error, and the read does again (only in the SubVI).  It's very strange.

0 Kudos
Message 4 of 21
(3,648 Views)

In your image for "in the top level version" the error cluster is not wired. Could it be that it does have an error but because the wire is not wired you are suppressing the error?

 

If so it may come down to the file not existing on an initial go?

 

No answers here, only questions,

 

Ben

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

@Ben wrote:

In your image for "in the top level version" the error cluster is not wired. Could it be that it does have an error but because the wire is not wired you are suppressing the error?

 

If so it may come down to the file not existing on an initial go?

 

No answers here, only questions,

 

Ben


Sorry, I made that a little confusing, but that case only runs when there is an error because if there is no error, the array will not be empty.  In any case, if the Read VI were causing an error on the top level VI, the second Read would be causing an error again like it does while in the SubVI. 

0 Kudos
Message 6 of 21
(3,624 Views)

Is it possible the file is being created in a parallel thread and not there yet?

 

And as a shot in the dark, can you toss the while loop since it does not do anything anyway?

 

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 21
(3,618 Views)

@Ben wrote:

Is it possible the file is being created in a parallel thread and not there yet?


Then the error would be coming from the Open/Create/Replace File function.  My similar follow on thought was a parallel process deletes the file before the read.  Seems very unlikely, but that is all I can currently think of.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 21
(3,614 Views)

I am not good at troubleshooting images, but if you take the working version, lasso the relevant code, and "create subVI from selection", do you still get the same error?

0 Kudos
Message 9 of 21
(3,607 Views)

@Ben wrote:

Is it possible the file is being created in a parallel thread and not there yet?

 

And as a shot in the dark, can you toss the while loop since it does not do anything anyway?

 

Ben


I'm not sure what you mean by the first part, but I tried the second part, and the problem still exists.

0 Kudos
Message 10 of 21
(3,582 Views)