LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append Text Header for Binary file

Thanks for correcting my VI Marco, I forgot the open and close functions.
 
Nabeel,
I work on project with somewhat similar file structures, in fact we have a file definition called the Arete Data Format (.adf) which includes a header and follows with images data (a boat load of binary 2 byte integers).  I would like to give you a more detailed solution to your problem, but I need a little more info.
 
How do you collect the header information?  A VI?  Or do you read in an ASCII file that was generated by another application?  Can you attach a sample of the VI, or the ASCII file?
 
Do you have a dedicated Labview VI that collects the DAQ data?  can you attach it?
 
Can these two applications be integrated into one application?
 
Just attach as mush as you can, and I will try to sort out a method for properly writing the .edf file.
 
My concern is that, now that you have stated that it is in interchangeable format file, Labview write strings and arrays to memory in a way that in not perfectly interchangeable with other applications such as matlab and C++.  It can be done though, it's just a little more complicated.
 
Chris
Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 11 of 21
(2,061 Views)

Hi fellows!!!!!

 

I found the solution, I divided the vi into two sub vis. First Vi created a text file to input patient information in it and save it, on pressing saving the data an applet for acquiring data pops up. This data acquisition is in binary raw data and continuously saved on the first created text file. I used pos mode, together with pos offset, it specifies where the read or write operation begins on a file. At the end before final just did swapping of the bytes from big-endian to little-endian for non labview applications.

 

Thank you, all of u guyz for help and leading me to the solution (i hope it works :))…

 

nabeel

0 Kudos
Message 12 of 21
(2,060 Views)

Sure Chris

Little more information, The complete application is one program. With different parts, it gets data from the operator about the patient and after saving the data the physical recording of EEG starts. At the end, both information are present on a single file. the top of the file contains the patient information (which can be of 4k byte) and then regular patterns of DAQ channels as binary raw information store. (the regular patterns means e.g first, get 10 samples from one channel then contnue with 10 samples from second channel until complete 16. then rotaion starts. ). i am sending u my basic data acq. vi, it starts getting data after the onset of hardware trigger (for syncronysation of event related applications).

regards

nabeel

0 Kudos
Message 13 of 21
(2,055 Views)

Hi Nabeel,

I made some minor changes to the code you attached.  Instead of incorporating the read within the loop, it is better to build an array using the shift register and write only once at the end of the acquisition, this will improve speed, writing to disk sometimes takes a long time.

I also set the endian to little endian at the Write function, this is easier than the byte swap that you had incorporated within the loop.

I am interested to see how you are building the header. 

 

Chris

Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 14 of 21
(2,039 Views)
Dear Chris
can i have changed VI in labviw 7.0? if not possible then in picture format?
 
regards
nabeel
0 Kudos
Message 15 of 21
(2,034 Views)
Heres Chris's VI in LabVIEW 7.0
0 Kudos
Message 16 of 21
(2,023 Views)
dev, this vi is the same which i loaded. there is not change in it.
0 Kudos
Message 17 of 21
(2,018 Views)

Hi Nadeel,

Sorry, I forgot to attach my VI, again.  I have attached a picture of the code for you to see.

Chris

Chris Reyerson
Optical Systems Engineer
Arete Associates
Tucson, AZ
0 Kudos
Message 18 of 21
(2,008 Views)
Hey people.. Please help me.?

I am Having a Problem with Header file and data file..

I am able to write a cluster of "dbl, I32, string" in binary file.. but I am not able to read it .. I am saving setting configuration of setup in data file before data starts...

To write cluster I am using "write Binary file" example and for Reading "Read binary fie" don't work... Can u suggest me any way? (using any loop.. or "byte stream refnum")

I am explaining In detail.. What i want is... Before I start storing data in binary file.. I want to store a header which discribes the test setup instruments.. Like Device No.,, Person name.., temperature.., date..,.. total 17 items of diffrent format.... Then I want to store the data in same binary file...

I want all in same file because If I read the file after some years.. I don't have to find any information regarding that test conditions. and can simply generate the report again that time. and this is very important...

Now.. as my file data is 65MB binary data.. It will be ok to append the header after data... or append data after header... ?

Will it be good idea to implement this? or is there any better way?

So.. I thought cluster would work good for this.. and tried to write in binary file .. But Reading is not possible (atleast for me) ..

If any one can Please help me..!!!!!
0 Kudos
Message 19 of 21
(1,794 Views)
Hi Cyborg
let me see if I've understood what you mean:
 
-) Which version of LabVIEW are you working with?
-) Second: the header file you need to store is something like 17 strings which refer to the data that will be stored?
-) In this case, there is the possibility to TDM files which allow the user to store both data in binary format and general information (for example an header) in text format; to this purpose you can see the following links:
 
 
 
I've also attached a VI which compares data storage for datalog and binary files; datalog files allow to store records, like clusters, and read them from a given position into the file (i.e. at the beginning, at the end, or with a given offset which customer can set up).
 
Hope this helps,
 
Best regards,
 
Fabio
Fabio M.
NI
Principal Engineer
Message 20 of 21
(1,773 Views)