LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File I/O does not save elements in array

Solved!
Go to solution

I cannot seem to save the elements in the array. If I stop the program and restart it, the array starts from 0 again. I want it to start from the value it stopped at.

 

Is it a shortcoming in the SubVI "Timer A1"?

 

Thanks for the help.

 

 

mhaque

Download All
0 Kudos
Message 1 of 18
(3,938 Views)

Use the "Set File Position" function and set it to the end after the open and before the first write.

Omar
0 Kudos
Message 2 of 18
(3,926 Views)

Hi Omar I did as you told, but it does not seem to work.

0 Kudos
Message 3 of 18
(3,919 Views)

@mhaque wrote:

Hi Omar I did as you told, but it does not seem to work.


No you didn't.  He told you to set it to "end".  You have it set to "current".

0 Kudos
Message 4 of 18
(3,907 Views)

I did set it to "end" but but it still did not work. Should I use a different file format or is there something instrinsically wrong with my code?

 

mhaque

0 Kudos
Message 5 of 18
(3,903 Views)
Solution
Accepted by topic author mhaque

Your Feedback Nodes are set to Globally Initialize on the First Call, as evidenced by the glyphs.  If you are stopping and starting your program, they should be set to Globally Initialize on Compile or Load, just Right-Click and change the setting.  This should give you the behavior you are looking for, but does not rule out intrinsic problems with the code.

Message 6 of 18
(3,890 Views)

Try again.  It works for me.  The only other thing I did was set the file open to "open or create" and disable the reading part that you have outside the loop since I didn't have your existing file.

Message 7 of 18
(3,887 Views)

The VI works for me well but I still have a few queries.

 

Firstly could I use the SubVI "Timer A1" as rentrant?

 

Secondly if I close the program, the timer again starts from 0. How do I make it start from the time I left it at when I close the program?

 

Thanks

 

mhaque

0 Kudos
Message 8 of 18
(3,835 Views)

@mhaque wrote:

How do I make it start from the time I left it at when I close the program?


You will have to save the time to a file and then read it in again at the start of your program.

Omar
0 Kudos
Message 9 of 18
(3,830 Views)

Omar Wrote


You will have to save the time to a file and then read it in again at the start of your program.

 


 

 

I put in the following code. It still does not work. Perhaps I made a mistake.

 

mhaque

0 Kudos
Message 10 of 18
(3,825 Views)