LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BIN file to ASCII file

Dear everyone,

I'm a novice about labview. I'm getting data from my daq card using labview.
Because I'm dealing with high frequency experimental data I need to write it
in BINARY file format. The problem is in order to analyze it I need to
change it to ASCII file format. I found out some example about displaying
the BINARY file. But I cannot find any example about changing the file
format and saving it. If somebody have some example vi files about that,
please help me.

Thanks in advance.
0 Kudos
Message 1 of 17
(7,598 Views)
Seungmin Cho wrote:

> Dear everyone,
>
> I'm a novice about labview. I'm getting data from my daq card using labview.
> Because I'm dealing with high frequency experimental data I need to write it
> in BINARY file format. The problem is in order to analyze it I need to
> change it to ASCII file format. I found out some example about displaying
> the BINARY file. But I cannot find any example about changing the file
> format and saving it. If somebody have some example vi files about that,
> please help me.
>
> Thanks in advance.

There are vi's in functions palette. The all White icons shows that vi
has opened diagram for reviewing. Open binary read/write functions and
see an examples.
As well take a look at manual and
:http://zone.ni.com/devzone/devzone
web.nsf/opendoc?openagent&9367440F7995676486256944006F2DE1&cat=71359FBAD517F4CB862567E0007B6F6E
--
Sergey Krasnishov
____________________________________
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
http://acs.levsha.ru
0 Kudos
Message 2 of 17
(7,597 Views)
This response does not answer the question. I think what the guy
is looking for is a VI which converts directly from binary to ascii. There
are no VI's included with Labview which do it. I had the same problem,
so I wrote my own, but it took a little while since I'm fairly new too.
it took a while
0 Kudos
Message 5 of 17
(7,596 Views)
Would it be possible for me to get a copy of the vi you wrote? I am very much a beginner at this. Please email me at srseng@ct2.nai.net. Thank you, Catherine
0 Kudos
Message 6 of 17
(7,596 Views)
Seungmig,

I don't have much experience with binary files, but the few times that I
have to read data from it I just took the vi "Read binary file", and placed
all contence in one big string. After that I stripped the string (Index &
strip) by reading n bytes from it, representing a double, word, floats,
doubleword etc.
In my case I had to readout infrared images containing a several datablocks,
emmission values and calibration info, all stored in one binary file. But
with the method I just described it worked fine; there were only some small
problems in converting the data to doubles and floats.

I hope this info will help you furter

Regards,

Pieter Bosstad


Seungmin Cho schreef in berichtnieuws
94kg5s$dog$1@hecate.umd.edu...
> Dear ever
yone,
>
> I'm a novice about labview. I'm getting data from my daq card using
labview.
> Because I'm dealing with high frequency experimental data I need to write
it
> in BINARY file format. The problem is in order to analyze it I need to
> change it to ASCII file format. I found out some example about displaying
> the BINARY file. But I cannot find any example about changing the file
> format and saving it. If somebody have some example vi files about that,
> please help me.
>
> Thanks in advance.
>
>
0 Kudos
Message 3 of 17
(7,598 Views)
Seungmin,

I have done this exact thing in my code for the same reason.
Basically, you read "chunks" of the binary file, change them to the EU
you want (divide by # bits of A/D, multiply by range of input, multiply
by EU conversion, add offset), and then write that to a file.

If you would like, I can email you the exact VI that I used. It's
commented, so you should be able to follow along. You'll see that it
isn't all that difficult to do.

By the way, my vi adds a time stamp to the data, so you'll see that,
too, but that's not a step you have to perform.

Mark

In article <94kg5s$dog$1@hecate.umd.edu>,
"Seungmin Cho" wrote:
> Dear everyone,
>
> I'm a novice about labview. I'm getting data from my daq card using
labview.
> Bec
ause I'm dealing with high frequency experimental data I need to
write it
> in BINARY file format. The problem is in order to analyze it I need to
> change it to ASCII file format. I found out some example about
displaying
> the BINARY file. But I cannot find any example about changing the file
> format and saving it. If somebody have some example vi files about
that,
> please help me.
>
> Thanks in advance.
>
>


Sent via Deja.com
http://www.deja.com/
0 Kudos
Message 4 of 17
(7,598 Views)
Can anyone either step me through this, or send me a vi which does this. I have only recently started using Labview and have very limited knowledge. I originally have an ascii file which I need to convert to binary for transmission, then I need to convert it back to ascii for analysis. Any help would be very appreciated.
Thanks
0 Kudos
Message 7 of 17
(7,595 Views)
Hi,

The convertion from BIN to ACSII depends on how you converted it from ASCII
to BIN.

You'll have to tell us what the binary format is...

Regards,

Wiebe.


"Ridge" wrote in message
news:50650000000500000077910000-1027480788000@exchange.ni.com...
> Can anyone either step me through this, or send me a vi which does
> this. I have only recently started using Labview and have very limited
> knowledge. I originally have an ascii file which I need to convert to
> binary for transmission, then I need to convert it back to ascii for
> analysis. Any help would be very appreciated.
> Thanks
0 Kudos
Message 8 of 17
(7,595 Views)
I am a little unsure, here is the total problem. I have to convert an ascii data file to binary for transmission, then once at the destination, it needs to be converted back to ascii for analysis. I have been looking at using the conversion vi converting ascii to binary but am unsure of how to save this and what format is required. I literally am bamboozled by it all and am getting very confused. Can you give any suggestions about what to do.
Thanks
0 Kudos
Message 9 of 17
(7,595 Views)
If I understand correctlly, you have a file like this:

********
1.23
2.34
3.45
********

And now you want to transfer it, using a serial connection? Or TCP/IP? Or do
you simply want an array of numbers?

This is important. A ascii string can be transmissioned as it is. So the
'transmission' part is the key question here.

Also, what do you consider a binary? Reading your question, I think you mean
a string, with binary data, relating to the ascii data. So you'll end up
with just another string. Do you need to binarise it for compression?

TCP/IP performs a hardware compression, so converting a string to a binary
string won't do very much.

Anyway, building a binary string goes like this:

Make a while loop, so that you
get each number one by one.
Use the Flatten To Sting function to get binary data.

To reverse:
Get bytes 0Xnr of bytes to 1Xnumber of bytes.
Use Unflatten From String to convert it to a number.
Get bytes 1Xnr of bytes to 2X number of bytes.
Etc (use a for loop, or a while loop).

Depending on the data format, you might not even get less data. (A dbl has 8
bytes of data. So if 1.23 is a dbl, you'll end up with 8 bytes {3FF3 AE14
7AE1 47AE, in hex view}instead of 4 {1.23}!).

Regards,

Wiebe.


"Ridge" wrote in message
news:5065000000050000007C910000-1027480788000@exchange.ni.com...
> I am a little unsure, here is the total problem. I have to convert an
> ascii data file to binary for transmission, then once at the
> destination, it needs to be converted back to ascii for analysis. I
> have been looking at using the conversion vi converting ascii to
> binary but am unsure of how to save this and what format is required.
> I literally am bamboozled by it all and am getting ve
ry confused. Can
> you give any suggestions about what to do.
> Thanks
0 Kudos
Message 10 of 17
(7,597 Views)