Write to binary question

Hi all,
I have an application which stores data. First it stores some particular information in a header file. And then it acquires data in some other. THey all are stored in binary format. I convert them in text file with Graph Acquired Binary Data.VI . I have no problem with the rest of the files, but with the header. The message when I convert it  is ' Cannot read from binary file'. Since with all the rest the conversion works, I assumed it is the writing to binary that is flawed. I peered the  program but I didn't succeed to find an explanation.
I would be really grateful if you can have a clue about it and share it with me.
I attached the application, I hope one of you can be of help. I annotated the area involved with writing the header binary file with "write the header file I' and 'write the header file II'(the action is divided, there is a single file).
Thank you very much.
Dana
Attachments:
Acq_alltests_interf2.vi ‏124 KB

For your first question: In your specific VI you are using the Open_Create_Replace VI. In one case you're using it with the "open or create" mode. In the other case you're using it with the "create or replace" mode. This second way is what's causing the advisory dialog. If you don't want to display advisory and replace the file anyway, then wire a True constant to the "advisory dialog?" input.
For you second question: The 6255 does have a certain amount of memory, and it's limited to 4095 samples. How this memory is used is dependent on how you do the data acquisition. If you do buffered acquisition then you're basically having the card collect data and store it into its buffer. Then your application would read data out of the buffer. If you don't read data out of the buffer fast enough then you will get the buffer filled up and then new data will have to force out old data. There are lots of examples that ship with LabVIEW that show you how to do data acquisition. Open the Example Finder (Help->Find Examples, and in the tree open "Hardware Input and Output" and then "DAQmx". You can also start here: Getting Started with NI-DAQmx.

Similar Messages

  • Bug in LV8 : 'Save for previous version' and 'Write to Binary File' VI

    Hello
    I am using LabVIEW 8's revamped 'Write to Binary File' VI with a 'TRUE' boolean constant wired to the optional 'prepend array or string size?' to write non-trivial structures to a binary file. I then read the file with the 'Read from Binary File' VI and everything is fine. I don't wire anything to the 'file (use dialog)' input (don't know if this can help).
    However, after saving my VI for LabVIEW 7.1, I cannot read the binary files created with the LV7 version of the VI anymore. After examining the LV7 converted version of the VI, there is a 'FALSE' boolean constant that is wired to the equivalent of the 'prepend array or string size' input, which breaks the binary format that is expected.
    The attached files are LV8 and 'saved for LV7' versions of a dummy VI that writes an array of 5 integers into a binary file. To test the bug, start LV8, open the LV8 version, run it and create a 'test-lv8.bin' file, then open the LV7 version, run it and create a 'test-lv7.bin' file. Check the content of the two files : the size of the array is indeed missing from the 'test-lv7.bin' file, which can be assimilated as a bug in my opinion.
    I think I found another one too : if in LV8 I wire the 'cancelled' boolean output of the 'Open/Create/Replace file' to the selector of a case structure, the 'converted to LV7' version VI will have an error, saying the Case Structure selector is not wired.
    Could someone please confirm these are indeed bugs ?
    Thanks in advance and have a nice day.
    Eric Batut
    Attachments:
    Test Binary File v7-v8 LV7.vi ‏15 KB
    Test Binary File v7-v8 LV8.vi ‏7 KB

    I'm using LV8.6 and need to read a .bin file created in MATLAB. This file obviously does not contain the 4 byte header that LabVIEW prepends .bin files with. So when I use Read from Binary File, I get no data (I'm trying to read an array of doubles). I've tried making my .bin file both in native and big-endian format and changing the representation (double, int64, float64) but none of this works. I noted that if I create the same array in a .bin file in LabVIEW and wire a FALSE to the "prepend array or string size?", my VI for reading .bin files can't read this file either.
    Any work-arounds here?
    (I'll try attaching my write & read VI's)
    Attachments:
    ReadWriteBinFile.zip ‏19 KB

  • Write to binary file

    I have a relatively large 3D array (Phase Settling), which I want to store in a Binary File. The array is a 15000 point sweep (after decimation), repeated up to 48 by 48 times (in two FOR loops, one inside the other), meaning it can end up having as many as 34,560,000 data points. At the moment, I am attempting to dump that 3D array into a Binary File in one go, using the following VI. There are two possile versions of this array (both the same size as each other) and, depending on which has just been tested, they will be written to their own individual file. Once both tests have been run and their results stored, the idea was to open both files, subtract one array from the other, and store the new 3D array to another Binary File whilst also displaying this latest data elsewhere in a higher-level VI.
    After its first trial run, LabVIEW presents me with an error message saying something along the lines of "LabVIEW had run out of memory". I assume it would be to do with this VI, since that's where the first error code appeared (Error Code: 2), apparently originating in a 'Write to Binary File' function.
    Any ideas as to how I could get round this first hurdle, or perhaps an alternative method I could try?
    Thank you.
    - James
    Message Edited by James Mamakos on 04-08-2010 10:07 AM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    Running out of LabVIEW memory when writing to binary file.PNG ‏30 KB

    Well, as shown in the attached screen-shot, the error indicator shows an error code of 2, and that the error occurred in one of the Write to Binary File functions.
    However, when trying to save this particular VI after a couple of tweaks, I was presented with the following pop-up alert message:
    LabVIEW:  Memory is full.
    Cannot save VI "Compare Amp - calculate.vi".
    LabVIEW Save error code 10: Default data space.
    Anyway, returning back to the main problem at hand, I've though of a couple of possible solutions...
    We don't really need a particularly high resolution to the data points for the comparison, so I could convert the array doubles into an array of singles to save space.
    I should be able to implement the 'Write to Binary File' for the initial arrays into the outer FOR loop, thereby reducing the amount data written in each instance by a factor of up to 48. The only problem I can foresee in this is that I'm not sure how to append 2D arrays into a binary file such that, when the file is read, they would appear as (or be easily converted into) a 3D array.
    As for the 'True' case in my case structure, am I being grossly inefficient in my passing of data from one place to the next? I know there are a lot of branches (and buffers?) of 3D arrays; is there a decent way to reduce this overhead by tweaking the data paths or something?
    - James
    P.S. The computer I'm using has 1GB RAM.
    Message Edited by James Mamakos on 04-08-2010 12:39 PM
    Never say "Oops." Always say "Ah, interesting!"
    Attachments:
    LabVIEW - error code 2.PNG ‏35 KB

  • Write to Binary File strips carriage returns (LV 8.2.1)

       I was using Write to Binary File to write a combination of strings, numbers, and time stamps.  When I later went to read the filel, it didn't quite make sense.  Although I had written strings that had lines ending in <CR><LF>, when I read them back in, they only had <LF>.  I checked this using other programs to read the file.  The <CR>'s have been stripped out!  Why would a "binary" file VI kindly edit your strings for you?  I needed the strings to be written exactly as they were.  The VI corrupted my data.
       I couldn't find any explanation for this in the help, nor any way to turn this behavior off.  Is this a known issue, a bug, or a feature?
    Regards,
       Dave T.
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

       Thanks, Altenbach and Jarrod, for your help.
       Time to eat crow.  At Altenbach's prompting, I created a sample program that would demonstrate the problem.  It didn't.  Turns out the files were fine.  I was reading them with the "Read from Text File" vi, with the EOL option enabled!  I had used another program to check the data in the file, and was basing my conclusion on that.  Unfortunately, I didn't use a good hex editor, and it turns out the program I used was also stripping the <CR> off.  So the data in the file was good, I was reading it wrong, and my double-check was reading it wrong.
    Cheers,
        Dave
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

  • Write-read binary file Error 116

    Hi all,
    I am saving double, numeric array data into a binary file and then trying to read it back but keep on getting Error 116 (cannot read from binary file).
    I have attached screenshots of the way I am writing my data into the binary file and then the way I am trying to read it. Basically my data is chunks of 2D double arrays, coming at a rate of 1hz and this is why I have to use the get and set file size functions prior to saving into the file (i.e. so that each time I can append my file with new data).
    I have tried all combinations for the write to binary and read to binary file functions, thus meaning I have tried little, big and native endian options but I keep getting the same error. Also played with the way I append my data, i.e. I have used both the "offset in bytes" and "end of file" options, just in case this made any difference, but again no luck.
    Any help would be much much appreciated.
    Regards,
    Harry
    Solved!
    Go to Solution.
    Attachments:
    Write_Bin.JPG ‏154 KB
    Read_Bin.JPG ‏100 KB

    Just as an amendment to my original post, I can succesfully read my data in MATLAB using the standard fread function with double precision. I presume that this means that there is nothing wrong with the way I write the data into the file. However, it would be useful for me to be able to read it directly from Labview without having to build matlab executables etc etc...
    cheers again

  • Write to binary file different from 8.0 to 8.2?

    I am communicating with a device via USB and am using a method setup by the USB driver programmer. To communicate, I write to a binary file with a filename of \\?\COMx. This has been working fine for about a  year in mfg with Labview 8.0. I recently "upgraded" to 8.2 and now it does not work. If I save for a previous version and run 8.0 it works fine. How can I make this work with 8.2?

    Yi Y,
    The USB device is one of the instruments we manufacture. The USB driver is written so writing to the USB port is just like writing to a file. I use the binary read/write VI's to send and receive commands to this USB device. The filename I use is \\?\COM#. I am told by the USB driver creator that this is common for low level C. I have been using this VI for that last year and recently upgraged from 8.0 to 8.2 and it does not work. I run the same vi under 8.0 and it works fine. This is not a common way to communicate, so will probably not get an answer.
    My next question is, is there any way to run an 8.0 dll or vi from an 8.2 executable?
    Thanks
    Hi dgtest1,
    Which USB device you are using, and which driver are you using? I'm trying to figure out specifically how you are communicating with the USB device by writing a binary file and how was the binary file written.  Could you please post more information to describe in more details about what your set up is doing?
    Thanks!
    Yi Y.
    Applications Engineer
    National Instruments
    http://www.ni.com/support

  • 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

  • GSA-H60L DVD Writer Firmware Update Question

    Hello all.
    i have a dvd writer here that needs to be updated.
    The model number is HL-DT-ST DVD-RW GSA-H60L.
    The trouble is that the firmware updater needs a Windows Vista 32 bit system to work, but i don't have one available at this time.
    Is there a workaround for this?
    Thanks.

    Hello hesdeadjim,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More. I understand that you have a DVD writer that needs to be updated, and I would be happy to assist you! To begin, I will need to ask you a few questions:
    What is the Product and Model Number of your desktop computer?
    What version of Windows do you have installed on your computer?
    Has your computer completed all of its important Windows Updates?
    Is this an on-going, or recent issue?
    Have you updated all of your HP drivers using the HP Support Assistant?
    Did your DVD writer come with your computer, or was it a later addition?
    Please re-post with the necessary information, this way I will be able to research this further for you. I look forward to your reply!
    Cheers!
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Write to file Question

    I am doing some expirimental modeling with a VI that many members of this board greatly helped me get going.  Part of this modeling is the creation of an arbitrary periodic function.  I've accomplished this using 30 "Y-Value" Inputs, and a frequency to create sort of a "unit function", or basically, one period worth of the desired function, with a maximum amplitude of 1, so that it is easily scaled.
    What I'm finding is that it would be nice to save these "Unit Functions" along with their corresponding amplitude and frequency to file, that I can later laod back into the program.  Thus, I need to both write the data to a file, (30 pairs of doubles, along with 2 independent doubles), and then have the ability to browse through all my saved functions, and load the desired one.
    I've used the express vi "Write to Measurement File" before, but that seems like a clumsy method for this.  So I then played with the various "write to..." vi's available.
    For a relatively small set like this, is there any benefit of one file type over another?  Obviously, much the data could go straight into an excel file, while it needs to be reformatted into strings to be stored in text.  I have little or no experience with bianary files.
    Are any of the file types easier than others to then load from?
    And is it possible to have the available (previously saved) functions selectable from a menu ring, or will I need to prompt the user?
    That said, I'm just looking for some general pointers on the area.  I've read all the associated help files, and read quite a few threads on specific issue.  But being new, I'd like to hear how you professionals would approach this function.
    Attached is my current code.
    Solved!
    Go to Solution.
    Attachments:
    Obtain Unit Periodic Input.vi ‏37 KB

    Given your description of what you want to do I would define a typedefed cluster that contains all of your parametric data for your data sets. You might want to allow the user to name these data sets when they save them. You can use these names as the section name. If you pass in the cluster to the write VI with the section name the data will be saved. Using the section name you can later read the data back. You can use the built in config file VI to read the section names from the config file. This will allow you to initialize your ring control. One thing I generally do for my applications is allow the user to select the ini file that want to use. That way they can save multiple versions taliored to their particular task. You could do the same thing and therefore they could have multiple data sets tailored for particular uses. Just offering that as some added flexibility for your application.
    Also, I generally don't include the handling of the config files in a state machine. This functionality is generally included in my UI task which is an event structure. Reading/writing/loading config files is more event driven by the UI than something in a processing state machine.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Read/write drive speed question

    I've been watching the read/write speeds in Activity Monitor while I've been transfering about 250 gigs from an internal drive to an external FW 800 Weibetech Drivedock. I notice that if I plug in any other FW drive at all, even another FW800 to the back of the drivedock, the transfer speeds suddenly drop from about 43mb to about 19 or 20mb. Also happens when I plug in to the front of the Mac Pro.
    Why is this... can those speeds only be achieved when one drive is plugged into the computer? How can I have more drives plugged in but maintain the fast transfer speeds?
    thanks

    If my schematic reading-ability isn't too off, USB is the same bridge, same controller, different bus(es):
    http://developer.apple.com/documentation/HardwareDrivers/Conceptual/MacPro_0608/Articles/M43_0906arch.html

  • HT5312 I can't write in any questions

    When I use my iTunes account on my iPod it says I need to answer security questions and I don't know them and online when I try to reset them I can't click on them and answer anything.......

    Click here and request assistance.
    (76928)

  • Integers to Binary Question

    I am trying to make a program to convert integers to Binary and I found a method that involves taking the number and dividing it by 2,discarding the remainder untill it eqauls zero(example here, http://www.cs.bham.ac.uk/~udr/Intro/2001/handouts/handout01.pdf) so i need to figuer out how to have it decide wether the number is even or not and print out accordingly, if someone could help that would be great!
    Thank you in advance

    I am trying to make a program to convert integers to
    Binary and I found a method that involves taking the
    number and dividing it by 2,discarding the remainder
    untill it eqauls zero(example here,
    http://www.cs.bham.ac.uk/~udr/Intro/2001/handouts/hand
    out01.pdf) so i need to figuer out how to have it
    decide wether the number is even or not and print out
    accordingly, if someone could help that would be
    great!
    Thank you in advanceif (number%2==0) //test if it is even
    System.out.println (blah blah blah);
    else
    System.out.println(blah blah blah);

  • Fincal Cut Studio Universal Binary Question....

    hello all. just was confused on which final cut studio should i be downloading first on my MBP. i have two versions of final cut studio, one is not the universal binary, and the other is the older version, regular final cut studio. my friend said i needed to install the first final cut studio, non UB, before i install the universal binary version. is this true? also, what is this universal binary version? i don't quite understand it. i tried looking around for the answers, but i was just confused. thanks in advance.

    Friends don't help friends install software. Especially when they're wrong. Mostly because they ARE wrong.

  • 10.4.4 Universal binary question...

    Anyone knows if the fact that 10.4.4 is universal binary means that installation in a non Intel may be different than it is now? Will there be code installed in my machine that it won't need, or will it only install the PowerPC version? Will it have an impact on the new features announced? Is any software included with 10.4.4 only Intel ready? (widgets, new versions of software, printer drivers, etc.?)
    Thanks,
    Mauro.
    PowerBook G4 Ti 1Ghz   Mac OS X (10.4.3)   1Gb RAM

    No. To everything. :o)

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

Maybe you are looking for

  • Streaming

    I have both the 1st & 2nd generation Apple TV, as well as a MacBook Pro and Time Capsule, which I use as an external hard drive to save videos and music. Is there a way on either version of Apple TV to stream directly from Time Capsule and not have t

  • JDev11.1.1.4 IDE error:  not displaying view link in  service's Data Model

    Greetings, I was trying to update master-detail relationship in the Data Model tab of the Service definition tab. Got an 'unexpected error happened' and Jdeveloper shut down. After I re-opened it, I do not see my adf view links under the packages in

  • BAPI to get matrial /qty/ bin from production order

    hii All, which is the BAPI name to get the  Bin/Material/Qty from production order

  • MacBook Air 2014 won't go to sleep

    checked my settings, it won't go to sleep and for months now when I try to wake it up will randomly not respond for 30-45 seconds.  Screen remains black and my curser will show up.

  • RSRT:  Getting this error when I click on u0093Performance Infou0094 tab for report

    Hi, I have two queries coming odd a particular cube. There were some performance issues so in RSRT, Properties, I checked the delta cache update box and the reports significantly improved their performance. Later, for both reports, in RSRT, “Performa