LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extra zeros when converting text file to binary file

Hey guys,
well i wrote this program to convert a text file that contains x,y,z points seperated by a tab into a binary file. I did this so i can jsut manually edit out points that i dont want in the text file and then just convert it back to binary. Anyways when i run the program everything works fine buuuuut it adds an extra point on the end, the extra point being the origin 0,0,0. Anybody have any ideas how to prevent this and jsut have it write the wanted data to the binary file?
0 Kudos
Message 1 of 3
(2,540 Views)
Hi alexiscoo…,
connect a false constant to the "prepend array or string size" input. This should solve it.

Mike
0 Kudos
Message 2 of 3
(2,537 Views)
The problem is that you also write the data to the file from the last iteration when the error already occurred. This will give you a triplet of default values (zero). You need to place the write inside a case structure and skip it when an error resulted.
 
btw:
  • file references don't belong in shift registers unless they need to be changed from inside the loop.
  • You could probably read your points using "read from spreadsheet file".
  • It seems inefficient to scan each datapoint. You have 4 file operations per iteration!!!
  • Instead of converting to SGL, you could wire a SGL diagram constant to the default input of "scan from file"
  • Wire the errors for the write train and keep it in a shift register.
  • Unless the data is gigantic, write the output in one single write operation instead of point by point.


Message Edited by altenbach on 06-19-2008 11:59 AM
Message 3 of 3
(2,533 Views)