LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

losing binary data

Solved!
Go to solution

I'm currently running a VI which every loop saves a 1-d array to a binary file. I let the loop run a few thousand times, but after transmitting the binary data to a .xls format I noticed it was dropping off the last few hundred loops (because I know what the data should have looked like). Basically I was running a waveform and it seemed as if when I let the waveform cycle 4 times, 3 would show up in excel. Is there any reason for this?

0 Kudos
Message 1 of 6
(2,951 Views)

I don't quite understand the file writing part. You said you're writing to a binary file. But then you said you're transmitting the binary data to a .xls format. How? Are you using another program to read the binary file you wrote from LabVIEW? Or are you using ActiveX to create an Excel workbook? Or, are you actually using Write to Spreadsheet File (which actually creates a text file)?

 

Please upload your code. It will be easier to diagnose your problem.

Message 2 of 6
(2,948 Views)

The code I'm using to write the original binary file is actualy realy big, which is why I was hoping explaining it might be simpler than someone running through it. In one VI, I write a 1-d array to a file. I wrote another VI that "reads binary file" and then "writes to spreadsheet". So I run one after the other. If you would still like my code, I've attached it.

 

EDIT: I've attached just the portion of my first VI which saves to a binary file.

Download All
0 Kudos
Message 3 of 6
(2,938 Views)

Just a wild guess:

 

One way of losing data is in your "decimate array" node before you write to spreadsheet. If the number of elements is not divisible by 3, the incomplete tail will get dropped.

Message 4 of 6
(2,901 Views)

Hm, interesting. I included the decimate array because as I mentioned it was a 1d array, so my data was coming out as 

x,y,x,x,y,z,x,y,z when i really want a 2d array with the "x,y,z" stacked in columns. Would not being divisible by three cause my to lose such large amounts of data though? I would understand throwing out the last two odd frames. But I'm consistantly losing something like 1/3 of the total. Thanks for the input and I'll play around with it a bit.

 

actually in looking at it, and I don't know if this is significant. I've lost EXACTLY half my data in the last two tries.

0 Kudos
Message 5 of 6
(2,896 Views)
Solution
Accepted by topic author mr. smithers

Fixed it! I was using the skeleton for reading a binary file from the example section for my vi and the skeleton had the data size set to 8 bytes. Apparently mine is 4 bytes? and so 8 was causing it to think there was only half as much data as there was. I changed it and all the data is there! Thanks!

0 Kudos
Message 6 of 6
(2,882 Views)