LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is this simple VI not working?

I had a problem in another VI and could resume to this simple one. On the first time it reads without problems, but from the second run on it can't read and it says end of file has been reached, although it doesn't stop de loop...

 

Error showed from the second run on:

 

Error 4 occurred at TDMS Read in Untitled 2

Possible reason(s):

LabVIEW:  End of file encountered.
=========================
NI-488:  Invalid argument or arguments to function call.

 

Thanks,

Rafael

0 Kudos
Message 1 of 8
(5,278 Views)

Hello Danigno,

 

Why is the shift register used for the file reference?

 

BR

Thomas

0 Kudos
Message 2 of 8
(5,270 Views)

I guess its happened because you have connected array to the data type input. And at the first read attempt you read whole data (but seems to be that you want to read two elemenths per iteration). Try to connect array element as data type instead of array. Just suggestion.

 

Andrey.

 

0 Kudos
Message 3 of 8
(5,256 Views)

tflink wrote:

Hello Danigno,

 

Why is the shift register used for the file reference?


That is a technique that's used to prevent null references coming out of loops. With while loops it's not an issue since a while loop runs at least once. However, with for-loops if you use tunnels instead of shift registers, and the for-loop, for whatever reason, does not run any iterations, the output tunnel will be a null reference even if it's being passed through. A shift register eliminates this problem. 

Message 4 of 8
(5,247 Views)

Andrey Dmitriev wrote:

I guess its happened because you have connected array to the data type input. And at the first read attempt you read whole data (but seems to be that you want to read two elemenths per iteration). Try to connect array element as data type instead of array. Just suggestion.


That wouldn't do it, since TDMS files aren't structured the same way as binary files. It's OK to wire a 1D array especially if you wrote out a 1D array of waveforms. In this case you would be reading the first 2 samples from each waveform that was stored in the TDMS file.

 

The behavior you're seeing is quite odd, and I'd almost say it looks like a bug. Once you read a limited number of bytes you cannot perform another read. It appears that if you want to do this you have to close the file and reopen it. I'd say this bears further investigation. 

Message 5 of 8
(5,236 Views)

So, then, is this a bug? Should it be repported?

I'm attaching this test-vi here. Is there any other way of reading only parts of this tdms file? (it has 8 channels)

0 Kudos
Message 6 of 8
(5,189 Views)

smercurio_fc wrote:

 

The behavior you're seeing is quite odd, and I'd almost say it looks like a bug. Once you read a limited number of bytes you cannot perform another read. It appears that if you want to do this you have to close the file and reopen it. I'd say this bears further investigation. 


Ok, it worked with opening and closing the file inside the loop... But the other one should have also worked, and it would be faster, ain't I right?

0 Kudos
Message 7 of 8
(5,186 Views)

All I can say is that it looks like a bug to me. I would suggest submitting a problem report to NI tech support so they can investigate this behavior.

 

And, yes, it would be faster if you didn't have to do the open/close inside the loop. My suggestion is that until you get a clear answer you will need to leave the code with the open/close inside the loop, and place a clear comment in the code to indicate why it's being done that way, as opposed to the original method. This way you'll remember why you did it in the future. Smiley Wink

0 Kudos
Message 8 of 8
(5,155 Views)