Binary file reading

Dear All,
I have Binary file. I want to read Bytes based on Patterns and each channel value (Byte values -- > Float conversion)  and storing it into Index array.
Please check the attachment for pattren format. 
Here, the biggest problem is we will get only pattern style, Based on pattern the data is already stored in Binary file just we need to read it means we need to set the Timestamp based on this.
Please give me some idea to read this kind of pattern files.
BR,
Guru
Munna
Attachments:
Data Reading.xlsx ‏15 KB
Data Reading.xlsx ‏15 KB

Hi Munna,
that pattern is quite hard to understand. It seems there is some information missing…
In your pattern table the data size for e.g. ch1 is given as "1 byte", but in your time schedule you use two bytes for ch1. How are those "ch start position bytes" to be identified?
Byte values -- > Float conversion
How do you want to convert those bytes to Float (SGL or DBL)?
storing it into Index array
What is an "index array"?
It seems you have to create a table from your pattern which identifies the bytes in the file. That seems to be the trickiest part as in your pattern#2 example you already have made a mistake (for ch4 there is no marking at timestamp 70ms)…
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome

Similar Messages

  • Binary File Read

    Hello everyone,
    I am not that comfortable with binary file reading. I am trying to learn.
    I have a vi which logs a sine wave in a binary file.
    The Read vi which I have written is not giving the expected data.
    Thanks in advance
    cooldude 
    Attachments:
    Log Data.vi ‏9 KB
    Read Data.vi ‏10 KB

    Attachments:
    Log.JPG ‏20 KB
    Read.JPG ‏13 KB

  • Binary file read byte unmatch

    I tried to read one line of binary file as the top of the screenshot.
    The result is as the left side. It shows the first part with text are correct. The ending part is not match with the raw one.
    I also tried read by byte, but still the same.
    Any suggestion, thanks.
    Solved!
    Go to Solution.
    Attachments:
    shot.JPG ‏48 KB

    What program created this binary file?
    If you can figure out how the file was created, then you can figure out how to read it.
    We can't help because all you've shown are some bytes and say that some are right and some are wrong.  What is the "raw one" you are referring to?  What do you expect it to look like?
    Message Edited by Ravens Fan on 01-26-2010 11:15 PM

  • Binary file read with bit offset..not byte offset.

    hi,
               i want to read a binary file with some offset ..not in bytes...  offset in bits..my data is a single bit data stream size of 1GB ,after skipping particular bit offset i want to read the data in byte order..
    Indrajit
    | [email protected] | [email protected] .

    hi , Gerd W 
                       i am not able to follow your answer.... here with i attached a file to describe my query more clearly.   Actually two channels of  1 bit data stream stored in two different files ,and the file size will be more than 10 GB. 
     i want to delay the channel B by 3 bits and i want to perform bitwise operation between channel A and shifted version of channel B..till the end of the data..
    now i am doing this without applying any delay by choosing a small block by block which corresponds to 1 sec of data .
    Indrajit
    | [email protected] | [email protected] .
    Attachments:
    bitwsie.png ‏16 KB
    bitwsie.jpg ‏52 KB

  • Binary file readed from Labview and Borland C++ v.5

    Hi Everybody!
    My problem is reading binary file from Labview 7.0 and Borland C++ version 5 is not the same.
    Only one difference is "space". Reading from Labview I got "00" (decimal) and reading from Borland C++ I got "32".
    I also try to read this binary file with Matlab 6  and I also got "00" as well as those from Labview.
    I really struck with this problem.. Anybody has an idea about this problem.
    Thanks a lot for anybody help!
    Nok

    Hi,
    These threads regarding reading of binary files was recently discussed in this forum
    You might find some answers for your query
    http://forums.ni.com/ni/board/message?board.id=170&message.id=99016&requireLogin=False
    and
    http://forums.ni.com/ni/board/message?board.id=170&message.id=153565&requireLogin=False
    Regards
    Dev

  • Binary File Reader to a Chart

    Hello All,
    Newbie having some trouble with reading a chart from a binary file. My problem may be with trying to use a binary file, I am not sure. The x axis time is not the same length as the actual test time. I have acquired a rms voltage from a VCR RF envelope. I'm using a 6009 DAQ with LV 7.1 on Win2K. I have attached the recording vi and the reading vi and a sample file.  I have tried different things including the examples that came with lab view. I need to write a small sized file because this test will last for 4 hours. I have another application that will run for 5 days.  I appreciate any help or ideas.
    Thanks,
    bh3560
    Attachments:
    Chart write_Read.zip ‏140 KB

    Hi,
    The program you have attached acquires, saves and reads data  in ASCII ( floating numbers) and not binary.
    To get an idea on how to write and read data in binary format, look at attached examples( taken from examples shipped with labview)
    Hope this helps
    Regards
    Dev
    Attachments:
    Cont Acq&Graph Voltage-To File(Binary).vi ‏88 KB
    Graph Acquired Binary Data.llb ‏72 KB

  • Binary file reading confusion

    Hi there,
    I'm trying to read a partially binary file with the following structure: The first three lines of the file are regular strings (one can see them correctly when opening the file in a text editor), the rest of the file's contents are integers in their binary form (one cannot see them correctly when opening the file in a text editor).
    How can I read such a file?
    Thanks in advance!
    +P.S.: If you're interested, I'm trying to read a .PPM file (look  here to find out about the format).+

    pfrc wrote:
    Hi there,
    I'm trying to read a partially binary file with the following structure: The first three lines of the file are regular strings (one can see them correctly when opening the file in a text editor), the rest of the file's contents are integers in their binary form (one cannot see them correctly when opening the file in a text editor).
    How can I read such a file?
    Thanks in advance!
    +P.S.: If you're interested, I'm trying to read a .PPM file (look  here to find out about the format).+Use a BufferedInputStream wrapped around a FileInputStream. Read and bytes and until you've hit two end-of-lines, then put those bytes into a String constructor. Note that you'll have to know which line end convention is used, or write your code so as to allow for any of the common ones. After that, continue reading bytes and processing however is appropriate for you.

  • Large binary file reading

    Hi,
    I'm currently using a java.io.BufferedInputStream to read a large binary file.
    I recently discovered there is a chunk of data that shows up near the end of each file. (these files are binary and are XX to XXX mb in size)
    Loading it all to memory first would kill my performance so I'd like to be able to come up with an alternate method.
    Does Java or the class above offer a way I can
    1) get the length of the file
    2) seek to a point say 2000 bytes from the end so I can start reading the binary data?
    Ideally I'd like to do a backwards read as that would be quickest. Is there a way to change the operation so that a 'read' would be reading backwards (from end to beginning)?
    For me speed is the #1 thing i have to worry about. So to be able to seek forward several hundred thousand bytes at a time would help tremendously.

    how does the 'skip' method work? Probably by using OS specific calls to read to a point in the file.
    maybe I could
    'skip' length - 20k from the start or something like
    that.
    Yep.

  • Blob for binary file, read/write problems

    Hi,
    I am relatively new to this type of development so apologies if this question is a bit basic.
    I am trying to write a binary document (.doc) to a blob and read it back again, constructing the original word file. I have the following code for reading and writing the file:
    private void save_addagreement_Click(object sender, EventArgs e)
    // Save the agreement to the database
    int test_setting = 0;
    // create an OracleConnection object to connect to the
    // database and open the connection
    string constr;
    if (test_setting == 0)
    constr = "User Id=royalty;Password=royalty;data source=xe";
    else
    constr = "User ID=lob_user;Password=lob_password;data source=xe";
    OracleConnection myOracleConnection = new OracleConnection(constr);
    myOracleConnection.Open();
    // create an OracleCommand object to hold a SQL statement
    OracleCommand myOracleCommand = myOracleConnection.CreateCommand();
    myOracleCommand.CommandText = "insert into blob_content(id, blob_column) values 2, empty_blob())";
    OracleDataReader myOracleDataReader = myOracleCommand.ExecuteReader();
    // step 2: read the row
    OracleTransaction myOracleTransaction = myOracleConnection.BeginTransaction();
    myOracleCommand.CommandText =
    "SELECT id, blob_column FROM blob_content WHERE id = 2";
    myOracleDataReader = myOracleCommand.ExecuteReader();
    myOracleDataReader.Read();
    Console.WriteLine("myOracleDataReadre[\"id\"] = " + myOracleDataReader["id"]);
    OracleBlob myOracleBlob = myOracleDataReader.GetOracleBlobForUpdate(1);
    Console.WriteLine("OracleBlob = " + myOracleBlob.Length);
    myOracleBlob.Erase();
    FileStream fs = new FileStream(agreement_filename.Text, FileMode.Open, FileAccess.Read);
    Console.WriteLine("Opened " + agreement_filename.Text + " for reading");
    int numBytesRead;
    byte[] byteArray = new byte[fs.Length];
    numBytesRead = fs.Read(byteArray, 0, (Int32)fs.Length);
    Console.WriteLine(numBytesRead + " read from file");
    myOracleBlob.Write(byteArray, 0, byteArray.Length);
    Console.WriteLine(byteArray.Length + " written to blob object");
    Console.WriteLine("Blob Length = " + myOracleBlob.Length);
    fs.Close();
    myOracleDataReader.Close();
    myOracleConnection.Close();
    This gives the following console output:
    myOracleDataReadre["id"] = 2
    OracleBlob = 0
    Opened D:\sample_files\oly_in.doc for reading
    56832 read from file
    56832 written to blob object
    Blob Length = 56832
    My write to file code is:
    private void save_agreement_to_disk_Click(object sender, EventArgs e)
    string filename;
    SaveFileDialog savedoc = new SaveFileDialog();
    if (savedoc.ShowDialog() == DialogResult.OK)
    filename = savedoc.FileName;
    // create an OracleConnection object to connect to the
    // database and open the connection
    OracleConnection myOracleConnection = new OracleConnection("User ID=royalty;Password=royalty");
    myOracleConnection.Open();
    // create an OracleCommand object to hold a SQL statement
    OracleCommand myOracleCommand = myOracleConnection.CreateCommand();
    myOracleCommand.CommandText =
    "SELECT id, blob_column " +
    "FROM blob_content " +
    "WHERE id = 2";
    OracleDataReader myOracleDataReader = myOracleCommand.ExecuteReader();
    myOracleDataReader.Read();
    Console.WriteLine("myOracleDataReader[id] = " + myOracleDataReader["id"]);
    //Step 2: Get the LOB locator
    OracleBlob myOracleBlob = myOracleDataReader.GetOracleBlobForUpdate(1);
    Console.WriteLine("Blob size = " + myOracleBlob.Length);
    //Step 3: get the BLOB data using the read() method
    byte[] byteArray = new byte[500];
    int numBytesRead;
    int totalBytes = 0;
    FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write);
    while ((numBytesRead = myOracleBlob.Read(byteArray, 0, 500)) > 0)
    totalBytes += numBytesRead;
    fs.Write(byteArray, 0, byteArray.Length);
    Console.WriteLine("numBytes = " + numBytesRead + " totalBytes = " + totalBytes);
    Console.WriteLine((int)fs.Length + " bytes written to file");
    fs.Close();
    myOracleDataReader.Close();
    myOracleConnection.Close();
    This gives the following console output:
    myOracleDataReader[id] = 2
    Blob size = 0
    0 bytes written to file
    If I manually add the blob file using the following:
    DECLARE
    my_blob BLOB;
    BEGIN
    -- load the BLOB
    my_bfile := BFILENAME('SAMPLE_FILES_DIR', 'binaryContent.doc');
    SELECT blob_column
    INTO my_blob
    FROM blob_content
    WHERE id = 1 FOR UPDATE;
    DBMS_LOB.FILEOPEN(my_bfile, dbms_lob.file_readonly);
    DBMS_LOB.LOADFROMFILE(my_blob, my_bfile, DBMS_LOB.GETLENGTH(my_bfile), 1, 1);
    DBMS_LOB.FILECLOSEALL();
    COMMIT;
    END;
    COMMIT;
    The write to file works perfectly. This tells me that there must be something wrong with my code that is writing the blob to the database. I tried where possible to following the Oracle article using large objects in .NET but that (along with most things on the internet) focus on uploading text files.
    Thanks in advance.
    Chris.

    myOracleCommand.CommandText = "insert into blob_content(id, blob_column) values 2, empty_blob())";
    OracleDataReader myOracleDataReader = myOracleCommand.ExecuteReader();
    This looks wrong, you shouldn't be using ExecuteReader unless you expect to get a result back. Try using ExecuteNonQuery to do the insert.

  • Binary File reading in Java

    can i read binary format file with java? if so, can you please suggest which class i should be looking into?
    Thanks

    FileInputStream

  • How to read a binary file written in LabVIEW 6.1 using VB ?

    How to read a file saved in binay forrmat in LabVIEW 6.1 platform through VB.
    Is there any code ?
    Thanks

    Hello,
    LabVIEW files stored in binary can take on just about any format that
    you choose, so there will not be a single piece of code that will give
    you what you are looking for.  You can use VB's standard file
    operation functions to read in a binary file created by LabVIEW, just
    as you would read in any other binary file.  See this page
    on Microsoft's web site for more information on the binary file read
    operation.  How you stored the data in the binary file will
    determine how you need to extract it from the byte array.  So, if
    the first element stored in the file was a 32-bit integer, you could
    extract an int from the byte stream to recover that piece of your
    data.  You would need to know in advance how the file was
    formatted in order to successfully retrieve the information.  If
    you need a reference for the VB functions, the microsoft link above
    will get you to some good information.
    Cheers,
    Matt Pollock
    National Instruments

  • Convert Large Binary File to Large ASCI File

    Hello, I need some suggestions on how to convert a large binary file > 200MB to an ASCI File. I have a program that streams data to disk in binary format and now I would like to either add to my application or create a new app if necessary. Here is what I want to do:
    Open the Binary File
    Read a portion of the File into an array
    Convert the array to ASCI
    Save the array to a file
    Go back and read more binary data
    Convert the array to ASCI
    Append the array to the ASCI file
    Keep converting until the end of the binary file.
    I should say that the binary data is 32-bits and I do need to parse the data; bits 0-11, bits 12-23, and bits 31-28, but I can figure that out later. The problem I see is that the file will be very large, perhaps even greater than 1GB and I don't have a clue how to read a portion of the file and come back and read another portion and then stop at the end of the file. I hope to save the data in a spreadsheet.  If anyone has some experience with a similiar situation I'd appreciate any input or example code.
    Thanks,
    joe

    sle,
    In the future, please create a new thread for unrelated questions.  To answer your question, you can use "Split Number" from the Data Manipulation palette.
    Message Edited by jasonhill on 03-14-2006 03:46 PM
    Attachments:
    split number.PNG ‏2 KB

  • Binary File IO DLL Problem

    Hiii
        I have developed one Binary file Read/Write Vi..  and then i have convert that vi in to DLL......
        Now i tested that DLL Vi  it is showing an error No 74. Actually for Binary write i will convert the Input cluster to Flattern to String and for Binary Read i will convert the output to unflattern to string.. I have attached the TEST.vi for reference
    Attachments:
    Binary Read#Write DLL.vi ‏18 KB
    Binary File Read#Write.vi ‏24 KB
    TEST.vi.vi ‏31 KB

    hi there
    if you want to read the size of the string you have to enable the "append array or string size" at the write file function. or you do not append the size and simply read all bytes.
    in any case you should replace existing files to avoid remaining bytes of larger strings written in prior calls.
    See attachment for details.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"
    Attachments:
    IO.JPG ‏66 KB
    IO_8.5.vi ‏27 KB

  • Fast processing of mixed representation binary files

    Hi Everyone,
    I see multiple ways of tackling this but I'm looking for the fastest approach as my data set is very large....
    The issue:
    I have a binary data file holding 2D data.
    It encodes 200+ differnet "columns" that are repeated in time (sampled)
    The data contains mixed data representaitons: a mxiture of  U8, I8, U16, I16 etc.
    They are all regullarly repeated in a known file structure (660 bytes per "line")
    I'd like to gnereate the 200+ differnet 1-D arrays form the file each using the correct data representaiton (or a sub-set of the columns).
    I can load the file in using binary file read and I specify U8 as the data type . I can then rediension to the correct 2D array.
    I'm now stuck on the fastest method to process the columns of data (1-2 bytes wide) into the corect numeric representaiton 1-D arrays (2x U8 to i16 etc.).
    Scanning byte by byte would be very slow.
    any suggesitons?
    Solved!
    Go to Solution.

    Taking wrote:
    Your sequence structures are unnecessary.
    I'd bet on Join Number being faster than any string functions.
    What sort of mechanism are you going to use for column definitions?
    Do you care if 8 bit datatypes get upcast to 16 bit?
    Agreed, the sequence structures only present to aid illustration.
    I'm not sure flatten to string is a "true" (slow) string function. I'm viewing it more as a container of bytes. I'm going to run some speed tests. The array massaging that has to go on to use the join function may be a large overhead.
    Column definitions will be sourced from a secondary text file that describes the file structure. The example conversion of 2 x  u8 to i16 would be replaced by a for loop (over all columns of 1-N bytes) and case structure (representation of the column) that processes the data. Ultimately each 1D array of correctly converted data will be saved off to it's own binary data file in a appropriate numeric representation within the case statement.
    Next I will be looking what for loop paralization I can achieve vs. source array memory copies. (again it is a very big source data file).

  • How to open and read binary files?

    How do I open and read Binary files?

    Did you  look on The Unarchiver's web site where it has a link to older versions? http://theunarchiver.googlecode.com/files/TheUnarchiver3.2_legacy.zip
    The best thing to do is ask your friends what programs they used to produce these files, or at least what format files they are producing.  Otherwise it's like being shown a car and given a bundle of 200 keys with no idea to which one to use, or even if any of them work with that car.
    Using The Unarchiver will likely not do anything because it too will not know what format files are involved, and they may not even been in an archived format.  If they sent you a Word file without telling you (a favorite of Windows users to do  -- it drives me crazy when they could have just sent them in plain text), The Unarchiver won't open them.  If it's a picture file then using Hexedit will just show you a bunch of unintelligible stuff as shown in an earlier post, though you may see a line of text providing a hint.
    As I said earlier, often .bin may be an executable program which needs another program to actually interpret it.  That's what Java is trying to do.  Still, it may think it can execute the file, but it is highly unlikely somebody would send you an executable program (and if they did I would not trust it).  For all you know it may be a Windows virus.

Maybe you are looking for

  • MacBook + Headphones = Problems

    Hi, My MacBook Pro is all of a sudden experiencing problems with the headphones I'm using. I've had this computer for about 9 months, and the heaphones have worked in all that time. Until today there weren't any problems, but then they acted funny. I

  • WUC-015 in Forms Builder Run Form

    When running a form via Forms Builder, I receive WUC-015. When running the same form via the "Run a form on the web" (runform.htm), it works fine. What did I configure wrong?

  • Full text search with XML input in Oracle

    Hi, I need to develope a web application which can do full text search for a library. We will use XML as the input data format and stored XML file in Oracle. How can I do full text search to the XML according todifferent tags or elements. e.g search

  • Reg Hyperion Essbase 9

    Hi, I had installed hyperion essbase 9 and i would like to know the working procedure of hyperion essbase 9. can any one please forward me a link where i can know how to start working on that!!!! Reg Kranthi

  • [SOLVED]No more sound in flash, but kmix shows a stream

    Hello all, I'm fairly new (and happy that I switched) to Arch .  When I installed Arch on my x86_64 based laptop everything worked fine.  Somewhere along the line I lost sound in flash.  I use KDE with the defaults for sound: Phonon, Pulse, and ALSA.