LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File write missing elements in array

I have an inner acquistion loop running at a rate of 32Hz for 1 second and an outer loop which has the write to file vi. The file write operates on the TimeBetweenPulses array. The main vi Javed concept - processing.vi and its sub vis are attached. I have also attahed a screenshot of the vi running.

 

From TimeBetweenPulses array you can see that the numbers 7.59, 2.56, 4.18, 3.59, and 7.15 but when I open the file write-read example.txt the entry 7.15 is missing. The vi seems to miss the firat reading immediately after the inner loop has restarted its 0 to 31 count. I have tried using differing write file vis and placing it inside the for loop with a case select loop but with no success.

 

Running on Labview 8.2

 

 

Any ideas as what is causing this?

 

Javed

 

Download All
0 Kudos
Message 1 of 7
(3,520 Views)

Hi Javed,

If I rewire your VI to just a write of the data if works OK. Can you simplify your Vi to just a write data and see what happens ?

0 Kudos
Message 2 of 7
(3,489 Views)

You mean remove the front panel display for the array and just leave it writing to file?

I will give this a try.

 

Best regards

Javed

0 Kudos
Message 3 of 7
(3,471 Views)

Hello Javed,

I've had a look at your code and from what I can see the data points are all being written correctly. Ive slightly altered what is written to the text file to illustrate that no data points are being dropped. It could be the way your other subVIs and main VI is manipulating the arrays of data. To test this VI I used a counter input and everything returned as expected. It may be beneficial to trace exaclty what your arrays are doing exactly before they are manipulated and written to the text file.

Look at the attached code and see that the data is actually writing correctly.

Good Luck!

Tom.
NIUK

0 Kudos
Message 4 of 7
(3,448 Views)

Hi Tom,

I had a look at your vi and the list of numbers that appear on the front panel array is still not identical to the output going to the write file.

It may be better if I rewrote the vi so that it outputs a simple double vi to file as it is writing to screen.

Regards

 

Javed

0 Kudos
Message 5 of 7
(3,436 Views)

Finally back onto this vi since I last looked at it in December.

Managed to write an output element by element rather than array by array and this proves that the array output is consistantly missing the first element in subsequent For loop arrays. The only problem I see in my element y element output is that in my vi I compare the previous element 0 with the current element 0 and output only if a difference is found, this is to stop duplicates from appearing on the output file.

BUT

This will now cause me a problem when I actually do receive 2 time differences that ARE exactly the same, as they will not be output by the ElementByElement.

 

Possible Solutions?

Try and incorporate both element write and array write methods to output all data.

If anybody has any other ideas let me know.

 

 

Kind regards

Javed

 

 

 

 

 

Attachments

NewArrayFromArrayAltered_ElementOutput.vi (and subvis)

ArrayByArray.txt      Outputs array at a time

ElementByElement.txt   Outputs element by element

 

 

 

0 Kudos
Message 6 of 7
(3,380 Views)
Hi Javed,
 
I still think you have to solve your first problem. If I understand you correctly you now have a work-arround for the first problem and introduced a new problem.
 
I do think you have to make your VI smaller to be able to find the problem. If you can produce a array with data (from your hardware) that should be written to a file and use this array as an input for 'make file loops' part then you can program a much smaller VI that only writes data to the files.
I think then we will find the real problem.

Message Edited by K C on 01-12-2007 12:55 PM

0 Kudos
Message 7 of 7
(3,357 Views)