LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from Binary File Doesn't work from SubVI


@altenbach wrote:

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?


I have tried this, and it is the same thing.  It's also only the Read VI.  I can put everything but that one in SubVIs, and everything runs fine.  I can make a SubVI for just that Read VI, and it still fails.

0 Kudos
Message 11 of 21
(1,210 Views)

@cwoolly wrote:

@altenbach wrote:

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?


I have tried this, and it is the same thing.  It's also only the Read VI.  I can put everything but that one in SubVIs, and everything runs fine.  I can make a SubVI for just that Read VI, and it still fails.


Well, can you attach a very simple VI that reliably demonstrates the problem? I currently don't have '2016 installed, but I could test in other versions. Did you contact NI?

0 Kudos
Message 12 of 21
(1,175 Views)

@altenbach wrote:

@cwoolly wrote:

@altenbach wrote:

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?


I have tried this, and it is the same thing.  It's also only the Read VI.  I can put everything but that one in SubVIs, and everything runs fine.  I can make a SubVI for just that Read VI, and it still fails.


Well, can you attach a very simple VI that reliably demonstrates the problem? I currently don't have '2016 installed, but I could test in other versions. Did you contact NI?


Yup!

 

If a mass compile does not fix it, send the code to NI so that they can verify they see the same error. If they don't it could indicate a LV repair. If they can verify it should be logged so it can be fixed.

 

Ben

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

With only images posted and no actual code that demonstrates the behaviour in a reproducible way, we can keep sitting here and guessing until the universe freezes over. Post the code (downsaved to 2016 or earlier) and we can look at it. So far in all of my 25 years of LabVIEW experience all I can say is that this is either a hidden wiring error that looks like it is wired correctly up but isn't, or it is not from this part of the universe I live in.

Rolf Kalbermatter
My Blog
0 Kudos
Message 14 of 21
(1,130 Views)

@crossrulz wrote:

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


No, you can create a file, so the error comes from the Read Binary, and then that error is either passed through to the Write (in the subVI version, preventing anything being written) or is not passed (in the non-subVI version allowing the Write to work).  There is nothing strange going on here, and it has nothing to do with subVIs; all the probe screenshots look exactly as one would expect, given the two different versions of code shown (and assuming the code has been run more than once, so the non-subVI version has generated a file).

 

CORRECTION: your right, by default it is just "Open", which would throw error 7.  So the file exists.

0 Kudos
Message 15 of 21
(1,120 Views)

But error 1 is an invalid parameter. If the file had been removed between opening it and trying to access it you would get a different error code. The error 1 is usually an indication of a refnum which has gone bad, either because it was auto-"garbage collected" by the LabVIEW runtime system since the top level VI in whose hierarchy the refnum was opened has gone idle, or because of wiring errors such as overlapping/hidden tunnels, or default value tunnels in previous iterations of a loop. Occasionally there are LabVIEW nodes that can create error 1 if different parameters for the node are contradicting each other in some ways, but those are seldom and far in between.

Rolf Kalbermatter
My Blog
0 Kudos
Message 16 of 21
(1,112 Views)

It looks to me like the 2nd read will Always fail. You write the Array to the file which'll put the file pointer at the end of the file, then try to read an Array back, which'll Always result in empty data. You'll have to set the File pointer to the start to do that, although since you know what you just wrote you don't really need to read the file at all, just send the Array wire forward.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 17 of 21
(1,098 Views)

@Yamaeda wrote:

It looks to me like the 2nd read will Always fail.


Yes it will.  Error Code 4 will be generated in that case.


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 18 of 21
(1,076 Views)

@crossrulz wrote:

@Yamaeda wrote:

It looks to me like the 2nd read will Always fail.


Yes it will.  Error Code 4 will be generated in that case.


This would explain a problem I've had in the past.  So, would the solution be to just close it, then open it back up to read again?  I get that I could just not read it back and pass along the data, I'm just curious.

0 Kudos
Message 19 of 21
(1,071 Views)

@cwoolly wrote:

This would explain a problem I've had in the past.  So, would the solution be to just close it, then open it back up to read again?  I get that I could just not read it back and pass along the data, I'm just curious.


I would just not do the read and use the data you already have that you just wrote.  The secondary route would be to use the Set File Position to 0 after Start (ie the beginning of the file) and then read.


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
Message 20 of 21
(1,065 Views)