Follow/read a growing binary file

Hello,
Application space:
1 - I have an application that has created and opened a binary file, and is is writing data to it
on a continual basis.
2 - Using another program written in Labview, I need to open this file for reading, get all the data available
(for the given file size at that instant) and update a strip chart/graph. The program also needs
to continue to follow that growing file and update the chart as new data is written to it by the
process (other program) that owns it.
Problem space:
If the file is already a certain size when the LV program opens it for reading, it needs to read in that
in it's entirety and update the chart with the complete data set as quick as possible. Then, it needs
to continue to check the file about every 250ms for new data and update the chart if there is new data.
So....How can I initially read in the file and update the chart as fast as possible, then use a controlled loop
rate of 250ms to continue to read in that same file if there is new data?
Suggestions...anyone? An algorithm? A rough diagram? alms for the blind?   ;~)
Gary.

try to read the file readonly.
Otherwise LabVIEW could block the writing or not succeed in opening the file.
And try reading the filesize and read again when data is available.
greetings from the Netherlands

Similar Messages

  • How to read non-java binary file?

    Hello Team,
    I have problem to read non-java binary file.
    Let me explain.... I have one binary file created in vc++ having fix structure. Structure of file is like String,int,int,int.
    Now I have to read this file in my java application. I am failed to identify length of String value of Structure in java.
    Can any body help me to solve this problem?
    Thanks in advance.
    - Pathik

    Thanks for guide me,
    I have try using 0x00. And its working.
    Now I have another problem:
    in file.ext , I have written one record having structure string,int and int.
    I have enter data as "HelloWorld", 100 and 111.
    To read first record from file file.ext, following code I am using:
    try
         FileInputStream fis = new FileInputStream("file.ext");
         DataInputStream in = new DataInputStream(fis);
         char ch;
         while((ch=(char)in.readByte()) != 0x00)
              System.out.print(ch+"");
    System.out.println();
         System.out.println("Integer 1 --> " + in.readInt());
         System.out.println("Integer 2 --> " + in.readInt());
         in.close();
         fis.close();
    catch(Exception ex)
         System.out.println(ex.toString());
    And I am getting following output:
    HelloWorld
    Integer 1 --> 0
    Integer 2 --> 0
    File file.ext is created in vc++
    I am not getting integer data. Plz guide me for this problem.
    Thanks in advance
    - Pathik

  • Reading little endian binary files

    Hi,
    Recently I tried to read from a little endian binary files. Here is the code:
    FileInputStream file_input = new FileInputStream (file);
    DataInputStream data_in = new DataInputStream (file_input );
    while (true) {
    try {
    short i_data = data_in.readShort ();
    catch (EOFException eof) {
    System.out.println ("End of File");
    break;
    System.out.println ( i_data );
    But I am getting wrong values (big-endian). I will be pleased if anyone can help me in this respect.

    Hi,
    Finally, I can do it easily with reading little endian binary files in java. Here is the code:
    FileInputStream file_input = new FileInputStream (file);
    DataInputStream data_in = new DataInputStream (file_input );
    while (true) {
    try {
    int low = data_in.readByte() & 0xff;
    int high = data_in.readByte() & 0xff;
    short i_data = (short) (high << 8 | low) ;
    catch (EOFException eof) {
    System.out.println ("End of File");
    break;
    System.out.println ( i_data );
    }

  • How to read/write a binary file from/to a table with BLOB column

    I have create a table with a column of data type BLOB.
    I can read/write an IMAGE file from/to the column of the table using:
    READ_IMAGE_FILE
    WRITE_IMAGE_FILE
    How can I do the same for other binary files, e.g. aaaa.zip?

    There is a package procedure dbms_lob.readblobfromfile to read BLOB's from file.
    http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#sthref3583
    To write a BLOB to file you can use a Java procedure (pre Oracle 9i R2) or utl_file.put_raw (there is no dbms_lob.writelobtofile).
    http://asktom.oracle.com/pls/ask/f?p=4950:8:1559124855641433424::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:6379798216275

  • Error when Write/read Cluster in binary file.

    hi all,
    I implemented a code (using the Labview example) to save and read cluster data (see attached file). The write part works properly but when I want to read the file, there is an error : "Error 4 occurred at Read from Binary File in main_save_data_V2.vi; LabVIEW: End of file encountered'.
    BUT the data are correctly open. Why is there such message? any suggestions?
    thank you.
    Cedric
    Attachments:
    main_save_data_V2.vi ‏19 KB

    Instead of predicting how many clusters to read, just set the count in the binary read to -1.  That will read all that it can and I got no error.  Here is all you need in order to read the file.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Read clusters.png ‏12 KB

  • Reading in a binary file and displaying an array correctly

    I am teaching myself Labview 7.1 and what I am trying to do is read in a text file of binary digits 10011001, 11011101 etc and then output these to a series of leds (boolean array) as well as to another array to display what was read in. I can get this to happen when I format the text file as 1,0,0,1,1,0,0,1 but then the array is 1 column by 8 rows (is this a 1by8 array) I want to read this data in as 10011001 displayed on 1 row and then the next row of the array to be 11011101, it displays 11111111 if I go above 3 digits, I know this is just a problem with binary versus decimal numbers, how can I format the input file so it is read in as 8-bit binary?
    Thank you in advance,
    Dan Ziehm

    Read the text file as string, then pass it through "spreadsheet string to array" with "," as delimiter, %b as format and an U8 array as type. I made a quick demo, see attached code image.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    binaries.gif ‏45 KB

  • Error when reading back a binary file

    Hello,
    I am writing out a binary file consisting of U32 arrays, packed strings, and clusters. I get error 116 when reading back. As long as I am synchronized on the correct data position why should LV care what I write to the file? In the example I write a simple 16 element array and a time stamp cluster. When reading back the array I get the error. What is the correct way to do mixed structures? Thanks.
    Attachments:
    file write.PNG ‏44 KB

    David,
    You can solve the problem in various ways. The easiest might be to modify the writer VI by wiring a True constant into the "header (F)" input of your first Write File node. That forces LabVIEW to include a four-byte header that specifies the length of the array you are writing.
    When you wire up the reader code the way you did, the length of the array you wire to the "byte stream type " input is irrelevant; by wiring nothing into the "count" input, you are implicitly telling LabVIEW to look for a header to determine the length of the array you are asking it to read. Because you didn't write any header, LabVIEW is interpreting the first four bytes of the array itself as a length. That length doesn't match the actual amount of data present in the datafile, so LabVIEW generates your error.
    An alternative solution would be to leave the writer unchanged and modify the reader VI: wire an I32 constant into "byte stream type" and wire a 16 into "count". The choice depends on what you prefer and whether or not these binary files need to be compatible with some other program or not.
    Another aside: you can dispense with your case that checks whether the datafile already exists. Just change the function input of the Open/Create/Replace to "create or replace" and wire a False constant into its "advisory dialog" input.
    Hope that's clear,
    John

  • Problem in Writing to/Reading from a Binary file placed in a Loop

    Hi
    As you can see in the attahced image, I attempt to write a set of 2*202 data in each iteration of the loop of the loop, yet when I try to read the data (in the second picture) I only get the first (or last, I assume) set of data, up to index 202. I needed to read two set (X, Y) of 402 valuse. So, I am not sure if I am making a  mistake in wrting to the file or reading from it! 
    I really appreciate it if someone could suggest a solution
    Ashakn
     

    You are only reading the first.  In your read, set your number to read to -1.  That will tell the Read Binary File to read all of the data instead just a single set.

  • Read and Write Binary File

    Hi...
    I have a problem. In C programming, if we want to read a file, we can determine to read it as text or binary. There is difference between them. But we still can read it in ASCII mode.
    My problem is :
    How to do that in Java ? I want to read any file in binary and I hope can read it in ASCII(8 bit) mode.
    I need it...
    Thanks for your help

    Hi,
    Check this link
    http://saeta.physics.hmc.edu/courses/p170/code/files.html#Java
    Gives you an example where you can see how to open a files for input or output in Binary or text mode.
    Hope this helps.
    Regards,
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Write/read struct in binary file

    Hi to all,
    I created a struct profile defined as follows:
    typedef struct profile {
    char name [30];
    float power;
    double frequency;
    struct profile * next;
    I can write the structures in a file, but I should do so that when you try to insert a struct, you control the field name and only if there is no other struct with that name,it is inserted in the file .
    Please help me !!!
    Solved!
    Go to Solution.

    I tried this way
    #include <ansi_c.h>
    #include <cvirte.h>
    char nuovo[50];
    int cmp;
    FILE *fp;
    struct profilo
    char nome[50];
    float potenza;
    double frequenza;
    }p;
    int main (int argc, char *argv[])
    if (InitCVIRTE (0, argv, 0) == 0)
    return -1; /* out of memory */
    fp = fopen ("c:\\Program Files (x86)\\National Instruments\\CVI81\\ESERCITAZIONI\\scrittura file 2\\profili.txt", "ab+");
     printf("Insert name: \n");
    scanf("%s",nuovo);
    do
    fseek(fp,sizeof(struct profilo),SEEK_SET);
    fread(&p,sizeof(struct profilo),1,fp);
    //printf("nome: %s\n",nuovo);
    //printf("p.nome: %s\n",p.nome);
    p.nome==nuovo;
    printf("p.nome dopo: %s\n",p.nome);
    cmp=strcmp(p.nome,nuovo);
    if(cmp=0)
      printf("Already exists\n");
    fclose(fp);
    else
    p.nome==nuovo;
    scanf("%f%lf",&p.potenza,&p.frequenza);
    }while(!feof(fp));
    fclose(fp);
    return 0;
    but don't work . 

  • How to read and write Binary files from Forms 6i C/S ?

    Hi There,
    I have a situation, where user wants to store attachements to a record (Could be any type of file, TXT, TIFF, or Word Doc etc.) and wanted to retreive later if they wanted to edit/read.
    We are using forms 6i and Oracle 9i in client/server environment setup. Does anybody know how to solve this requirment. I'm ale to load image files with read_image_file, but it could be text some times and it could be some thing elses like word doc or excel.
    Also i have to give user an option to view existing file attachments. I'm Planing to use BLOB in database table to store files.
    Any help in this regards is appreciated

    Thanks,
    Venkat

  • "Read from Binary File" and efficiency

    For the first time I have tried using Read from Binary File on sizable data files, and I'm seeing some real performance problems. To prevent possible data loss, I write data as I receive them from DAQ, 10 times per second. What I write is a 2-D array of double, 1000 data points x 2-4 channels. When reading in the file, I wish I could read it as a 3-D array, all at once. That doesn't seem supported, so I repeatedly do reads of 2-D array, and use a shift register with Build Array to assemble the 3-D array that I really need. But it's incredibly slow! It seems that I can only read a few hundred of these 2-D items per second.
    It also occurred to me that the Build Array being used in a shift register to keep adding on to the array, could be a quadratic-time operation depending on how it is implemented. Continually and repeatedly allocating bigger and bigger chunks of memory, and copying the growing array at every step.
    So I'm looking for suggestions on how to efficiently store, efficiently read, and efficiently reassemble my data into the 3-D array that I need. Perhaps I could simplify life if I had  "write raw data" and "read raw data" operations that write and read only the numbers and no metadata.then I could write the file and read it back in any size chunks I please -- and read it with other programs besides. But I don't see them in the menus.
    Suggestions?
    Ken
    Solved!
    Go to Solution.

    I quote the detailed help from Read from Binary File:
    data type sets the type of data the function uses to read from
    the binary file. The function interprets the data starting at the current file
    position to be count instances of data type.
    If the type is an array, string, or cluster containing an array or string, the
    function assumes that each instance of that data type contains size information.
    If an instance does not include size information, the function misinterprets the
    data. If LabVIEW determines that the data does not match the type, it sets data
    to the default for the specified type and returns an error.
    So I see how I could write data without any array metadata by turning off "prepend array or string size information", but I don't see any way to read it back in such bare form. If I did, I'd have to tell it how long an array to read, and I don't see where to do that. If I could overcome this, I could indeed read in much larger chunks.
    I'll try the auto-indexing tunnel anyway. I didn't tell you the whole truth, the 3-D array is actually further sliced up based on metadata that I carry, and ends up as a 4-D array of "runs". But I can do that after the fact instead of trying to do it with shift registers as I'm reading.
    Thanks,
    Ken

  • 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.

  • 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

  • Read binary file in LabVIEW 2012

    Hi,
    Have anyoune experienced problems reading binary files in 2012 previously saved in 2010.
    As shown on attached image, the same VI is opened in 2010 and 2012 reading the same binary file containing the data structure "ProcessList IN".
    I suspect it has something to do with the variants ?
    The error message does help a lot (-;
    Any ideas ?
    Kind regards
    Kahr
    Regards Kahr
    Certified LabVIEW Architect
    CIM A/S
    Attachments:
    Read_Binary_File_Error_LV2012.png ‏426 KB

    Hi Kahr,
    "error 1" tells one of the input parameters is wrong: it's either the path or the cluster datatype! The error message only mentions a file path AS AN EXAMPLE!
    You're using BinaryRead similar to those old Datalog file functions to read a cluster of several data. It has been know that datalog files get tricky when one is using a different LabVIEW version to read them due to changes of internal data representation. Maybe that's the point that hits you now?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • DVD Drive Noise

    The last few days my DVD drive has been acting strangely. When I insert a disk it takes it like normal but then when it starts to read it and the disk starts spinning it makes a very loud spinning noise like a metal fan grinding on some other metal,

  • Final Cut Pro 10.1.2 - Continuous Viewing of Clips

    I am attempting to make the switch from iMovie to Final Cut 10.1.2 and all is going well except for viewing of events.  I make highlight dvd's of my sons sports seasons.  In iMovie I am able to continually view all clips in the event.  It automatical

  • Like Purchase Analysis - Selection Criteria

    Hi To All, In Administration -> Purchasing -A/P ->PurchasingReports ->PurcahseAnalysis Same like that, i want to create Selection Criteria for my user screens.... Whether its possible...? If S, how can i do that..?

  • Best way for a thread to wait without busy-waiting

    Hi! I have a thread that has nothing to do but to monitor the status of a variable public static boolean askToClose. This variable is set by other threads to indicate that this thread should stop now. But I don't want the thread to busy-wait like in

  • Creative cloud desktop app keeps signing me out

    made a new password and everything. I can't log into the creative cloud app at all.