LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

weird data reached in text files

Hi all,

I am seeking for some opinions about a problem I encouter in an experiment. I would very much appreciate your thoughts. There are the well-known programs in the Example Finder:
1. Write binary file - which takes inputs from a sinus wave generator.
2. Cont Acq& Graph Voltage - which in my case takes the input from a channel of a DAQ NI 6255
So with these two I get two binary files from which I want to extract the information by means of a conversion to a text file.
When I convert the bin files to text, I use the same VI program (which I attached) to do that. The conversion for the 1st VI looks as expected, but for the 2nd is really weird!.
For the data in the 1st text file see textFile.txt file attached.(One would get the same result if it runs the VI):

For the data in the second text file, see textmydaq2.txt file attached.(The data should normally record values ranging from 4.XX to 8.XX):


Should I constraint the data with some data format to avoid such strange values? Or is it something else I should do?
Thank you very much for any kind of support.

Dana
0 Kudos
Message 1 of 5
(2,838 Views)
I can see there is a problem for the server to upload maybe other files(like txt files) different than VIs.
As I cannot attach the txt files, I will provide you with samples:
Here is a sample for the 1st text file(One would get the same result if it runs the VI):

0.00    376.74    752.00    1124.29    1492.14    1854.10    2208.75    2554.68    2890.52    3214.96    3526.71    3824.54    4107.28    4373.81    4623.08    4854.10    5065.97    5257.84    5428.96    5578.66    5706.34    5811.50    5893.72    5952.69    5988.16    6000.00    5988.16  


Here is the result in the second text file(The data should normally record values ranging from 4.XX to 8.XX):

0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    73333305348950320900000000000000000000000000000000000000000000000000000000000000000000000000.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    633318785695744.00    0.00    0.00    0.00    9663677760.25    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  

Best!
Dana
0 Kudos
Message 2 of 5
(2,837 Views)
What data is in the 'Data from file' array, is that what you expect?
Add an indicator for the converted string.
Make sure you select and new filename.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 5
(2,828 Views)

The problem is in the endianism.

Example 1.  Write to binary file is set to Little endian on the write binary file Function.

Example 2.  Cont Acq & graph voltage to file(binary) does not have any value written to the endian input of the write to binary file function.  The default is Big endian.

So to read the files from example 2, change the little endian constant to big endian in your VI.

If you look at the block diagram of each of those example programs, I think you'll see what I mean.  It was probably not a good idea for NI to create examples that are different from each other on that point.  It would have been better to stick with one (I'd say big endian because that is the default of the write binary file VI).

You'd either have to find a way to distinquish between the files and use a case selector to put in the proper enum constant in your reader program.  Or rewrite on VI or the other and set the endianism one way or the other to make both of the writing VI's consistent with your reading VI.



Message Edited by Ravens Fan on 01-19-2008 08:24 PM
0 Kudos
Message 4 of 5
(2,813 Views)
Thank you very much for the opinion, Ravens Fan.  Indeed, you were right. Now I can get normal values, although not the one I expect , I suppose for the reason that they come from a binary file that stored unscaled data.

I kept the approach of storing the data in an unscaled way in a binary file according to the Cont Acq&Graph Voltage VI, and I use the Graph Acquired Binary Data VI to see the information stored.
To the latter I added a Write to Spreadsheet icon, but here comes the problem - when I open the resulted txt file to see what values I get, I only have one single value.
I attached the file with my modification, as I wish to convert the binary values into text.
I hacked a probe before the Write To SpreadSheet and the signal seems ok, so only when it stores it , the problem occurs.
Do one of you have any idea what is happening?

0 Kudos
Message 5 of 5
(2,788 Views)