LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close File

Hi,
I am getting error in Close file .
For more clarification i am attaching the word document and sample code
Download All
0 Kudos
Message 1 of 4
(3,154 Views)
You get an error because your string array is empty and thus the loop thus runs zero times. This means that the output tunnel for the file reference is not a valid reference and the close fails.
 
One possible solution would be to feed the file reference via a shift register. Shift registers output the input unchanged if the loop runs zero times while a plain output tunnel will output the default data for the datatype.
 
Also:
  1. your sequence structure has no purpose.
  2. Your string array should be a control, not an indicator. Now you longer need the local variable.

This is all you need:



Message Edited by altenbach on 12-17-2007 11:10 PM
Message 2 of 4
(3,140 Views)
Hi,
 
Thanks altenbach! Here and here are a few more resources you can use for creating shift registers and performing file I/O. Happy programming!
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments
0 Kudos
Message 3 of 4
(3,095 Views)

Hi,

There is 3 reasons vi your vi will not run properly when trying to execute it.

1. If you are not accessing a existing file you have to

select "open and create" for "operation" in the "Open/Create/Replace File"-call

 

2. The "file path" is empty

 

3. The "array 2" is empty, thus the loop whill never execute.

Use shift register to handle that issue.

 

/ Mikael

0 Kudos
Message 4 of 4
(3,074 Views)