From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

EOF detection

Solved!
Go to solution

Hi all,


I need to read a *.mat file converted in *.txt and use it as data source (palyback file).


I've done a trivial VI so to understand how works FILE I/O and is not clear how detect the EOF.

Basically my trivial example is made of following steps :


1) Open the source and destination files
2) in case of none error on both operation opend a while loop and reads from source and copy in destination
3) If the error code from read operation on source file is 4 (= EOF detected)  than close the while loop and close all files


Now, I'm not anble to close the while loop and inside the destination file I found concatenate data from source file. Seems that after the end of source file, I restart from the top.


Example :
source file contains 12 34 56 78 90 => destination file : 12 34 56 78 90 12 34 56 78 90

 

In attach the VI for 2016 version.

 

Thanks for any suggestion

0 Kudos
Message 1 of 3
(2,268 Views)

Hi zundap,

 

- always use shift registers for references!

- why do you need a loop when you read the whole input file at once?

- why do you close the output file in the loop and again after the loop?

- why don't you stop the loop with each error, not just error 4?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,254 Views)
Solution
Accepted by topic author zundap1970

Hi zundap,

 

as soon as you wire a constant/value at count input of FileRead you will get your EOF error…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(2,242 Views)