Read Binary File - variable binary format

Hi Everyone,
I'm using the "read from binary file" subvi to interpret some data from a file. I have the code running fine if the the temp file is always the same format, however I want the "read from binary file" to adapt to different file structures based on a user input. Here's a snapshot of my current VI:
The structure of the file I'm reading can change, so I tried to make it so that user input would change the way labview interprets the binary structure. I did this using case structures. The issue I ran into is that the ouput of the different case structures merges into 1 line, and since each case structure's binary format is a different array size I get an error:
======>
Does anyone know of a way to remedy this issue?
If you take a look at my file, I was thinking about putting all of my commands that interpret the binary file and parse the data into a case structure similiar to the one above. I was trying to avoid this as I would end up with a set of the entire code in 12 different cases, and if I wanted to make a small change to the the code I would have to change all 12 cases.
Thanks for any suggestions!
Attachments:
Read Copy of Binary File - Static.vi ‏105 KB
Read Copy of Binary File - Variable.vi ‏105 KB

One solution is to include the File Read into the case structure. But you need to find a way to return the different types of data records as you obviously can't connect them to the same indicator.
All in all I find your design rather crude anyhow. Reading a file and letting the user decide what data type to expect is going to give lots of errors. Instead the file should contain information of what is in there and the reading routine should decide based on that how to interpret the next bunch of data.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions

Similar Messages

  • Binary file of unknown formats

    Hello everybody,
    I posted a message earlier today but unfortunately I missed to give more details about my problem. I am sorry about that. I am a new user of LabView so I still have many things to learn. What I am trying to do is use LabView (8.2) to read a file that was created by UVP Monitor, V3.0 (*.mfprof file).
    This package saves fluid velocity information. There are 65 channels that form a velocity profile in a pipe. Also, there are 4096 velocity profiles, each velocity profile was captured at a time rate of 9 ms. I don’t know what is the format of these values.
    At present, I obtain a text file from UVP Monitor, then process the data using FORTRAN and finally plot the results. I want to avoid this and read the UVP file, process, analyze and plot the data using only LabView. I want to read individual experimental parameters as well as the bulk of the data. In this way the user has different options to choose from before processing and plotting the results. I actually built a VI that processes and plots the text files and it runs great.
    The problem I am facing now is that I want to read the UVP file but I have no information about the structure of it. I am assuming it is a binary file but that is all I can say about it.
    The header and footer seem to be in text format, that is all I can read; however, the body of the file I am not yet able to read.
    The information from the file is sent to the type cast function. Then I set a string indicator in the “Normal” option in Properties. I can read the header and footer but not the body of the file; for the body of the file all I can see is characters of the type
    “C¾ Ü Qþ  X@ “. One of the other options, Password, seems to provide an output of just the characters that were originally written, but then again, I can not read the characters because it is only asterisks and I can not copy them onto a word processor either.
    I have tried other options as well, such as Variant to flattened string and flattened string to variant, flatten to string and unflatten from string. Unfortunately none of them worked.
    I am attaching the VI I wrote and a sample UVP file , I would appreciate if someone could explain to me how to deal with  complex binary files in LabView and share an example with me if possible.
    Regards,
    Roberto
    Attachments:
    BINARY Read UVP file.vi ‏45 KB
    Test UVP file.zip ‏693 KB

    OK, here's a quick draft how you could do it in LabVIEW. Modify as needed, e.g. slice out the interesting columns, etc.
    The header has some binary data that may, or may not, mean something useful.
    See if the data "looks" about right.
    Message Edited by altenbach on 04-26-2007 08:13 PM
    Message Edited by altenbach on 04-26-2007 08:15 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    BinaryRead.png ‏10 KB
    BINARY Read UVP file2.vi ‏46 KB

  • Binary file format to Ascii format

    Hi,
    I have a file in binary format in app server. I want to read the file in Binary mode and write that in legacy text mode. Problem here is... when I read that file in binary mode and passing to internal table. First record was fine from the second line carriage return(##) messing up my format. Anybody has any idea.
    Thanks
    Raj

    hi,  you can try some class like CL_ABAP_CONV_XXX,  E.G. CL_ABAP_CONV_IN_CE.
    some of them support us to convert Binary code convert into Text.

  • 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

  • Binary file write cancatenat​ion during writing

    Hi, 
    I'm trying to write a 2D array into a binary file and save the whole complete array in 2D.  As shown in the picture, data is written and appended to the binary file during each loop.  However, each loop would generate a 5x800 2D array (5 rows, 800 elements in each row).  Right now I have to use another vi to process the binary file I saved to concatenate all the arrays in the binary file to finally obtaion a 5 x 800n (n is the number of loops) array.  Is there a way to save the data into binary file in that format during each loop instead of writing into different segments and I have to concatenate different segments together after that?  
    On the other hand, if there's a way to do that, would that increase the loop cycle time because it's more computationally expensive?  Thank you very much for your help.
    Thank you,
    Charles
    Attachments:
    picture2.png ‏37 KB

    See the attached examples.
    If you have the file open you can basically just write data to it whenever you have it available, just do not include the length. It can cost a bit to write single elements so the row option is more commonly used, but it depends on how large each row is (if they are huge then it will cost to much to keep them in memory and you write parts of each row instead...). 
    I have not covered cases where you need to close the file and add data later, but the difference then is just that you need to set the write position after you have re-opened the file.
    MTO
    Attachments:
    Write and read 2D array.vi ‏26 KB

  • How to read multiple files of a specified format from a selected folder?

    i want to read multiple files of specified format from a selected folder, even if the selected folder contains multiple sub-folders, is it possible, if so please provide me a sample.

    try this:
    foreach (string dirPath in Directory.GetDirectories(WriteYourPathHere, "*",SearchOption.AllDirectories))
    string[] files = System.IO.Directory.GetFiles(dirPath, "*.txt");
    //loop over files array and do what you want with .txt files picked up during the loop
    OR in one line also:
    foreach (string file in Directory.GetFiles(WriteYourPathHere,
    "*.txt", SearchOption.AllDirectories))
    Fouad Roumieh

  • Read TDMS file in MATLAB on x64 Windows

    I have read many posts on this forum regarding reading TDMS files in MATLAB, but the DLL available only works on 32-bit windows. Has anyone come up with a 64-bit DLL? I know there is some MATLAB code available to read the file as binary but it would make everything faster for me if there was already a DLL similar to the 32-bit version. Plus, using C code would be better since I want to read the file continously (perhaps every 2 seconds) in MATLAB for real-time analysis.

    As of now, there is no support for 64 bit but it is a possible feature for future releases. Keep an eye on the DLL download page for new versions.
    Sappster

  • Unable to read multiple files in BODS

    hi all,
    i am unable to read multiple files [with same format of fields] using wild card characters in file name.
    scenario:
    i have 2 files: test1.xlsx & test2.xlsx
    in the excel file format, for the file name column, i have given test*.xlsx.
    and done the direct mapping to target column.
    but when i run the job i am getting below error.
    at com.acta.adapter.msexceladapter.MSExcelAdapterReadTable.ReadAllRows(MSExcelAdapterReadTable.java:1242)
    at com.acta.adapter.msexceladapter.MSExcelAdapterReadTable.readNext(MSExcelAdapterReadTable.java:1285)
    at com.acta.adapter.sdk.StreamListener.handleBrokerMessage(StreamListener.java:151)
    at com.acta.brokerclient.BrokerClient.handleMessage(BrokerClient.java:448)
    at com.acta.brokerclient.BrokerClient.access$100(BrokerClient.java:53)
    at com.acta.brokerclient.BrokerClient$MessageHandler.run(BrokerClient.java:1600)
    at com.acta.brokerclient.ThreadPool$PoolThread.run(ThreadPool.java:100)
    please let me know if there is any solution to this.
    regards,
    Swetha

    Hi,
    i just copied a xlsx file with 3 different names (Test_Data.xlsx, Test_1.xlsx, Test_2.xlsx) and tried with below options and it worked for me.
    Note: I tried on the same OS and DS 4.1 SP2(14.1.2.378)versions. In Linux File names are case sensitive.

  • How do i read pdf files on mac air, i have downloaded adobe reader and not working

    How do I read any files in pdf format? I have downloaded adobe reader yet have not been able to open pdf files?

    If you can't view PDF files in Safari, take these steps.
    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Programmatically reading .indd files.

    Hey everyone,
    I've been trying to get this right, but after having called with Adobe support and sales, I've turned to the community. My situation is like so: I need to read .indd files (in that format, no .idml) to read the XMP data that's embedded within. My environment is a 64-bit Linux server with Debian 7 running, with Ruby as the language of choice for the project. Any language is OK as long as it runs on this platform. I know, however, that the Adobe InDesign license strictly prohibits reading data explicitly from .indd files and encourages use of ExtendScript. Adobe InDesign Server is a possibility, but the price is too high for our purposes.
    What would you recommend?

    Instead, I was looking for a viewer of these files so that I can view them on any computer. Now, do you understand?
    Thanks
    Bye

  • Reading a binary file to string variable does not populate correctly

    Hi, I am new to Adobe Air/Flex and I'm trying to read a
    binary file which also contains text in "cleartext". The problem
    I'm having is that when I call FileStream.readUTFBytes method, only
    the first 6 characters are showing up in my string variable
    "contents" when I debug it in FlexBuilder or use a trace command
    and debug it. I have also tried with other types of files but I
    have a similar problem unless it's a non-binary file.
    Am I doing something incorrectly or should I be reading a
    binary file differently than the way I'm reading it currently?
    The source code is shown below.
    TIA,
    Magnus
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import flash.filesystem.File;
    private function readFiles():void{
    var feedFile:File = File.userDirectory.resolvePath( "Local
    Settings/Application Data/Microsoft/Feeds/AppScout~.feed-ms" );
    var stream:FileStream = new FileStream();
    stream.open( feedFile, FileMode.READ );
    var contents:String =
    stream.readUTFBytes(stream.bytesAvailable);
    trace(contents);
    stream.close();
    ]]>
    </mx:Script>
    <mx:Button x="121" y="66" label="Button"
    click="readFiles()" />
    </mx:WindowedApplication>

    It's difficult to tell what it is, it looks like a binary
    pipe symbol but I can copy it from TextPad for example. Some of the
    characters following it cannot be copied from TextPad which I
    assume is because it's null. I can read the whole file in C#/.Net
    and assign it to a string variable without any problems but perhaps
    Air is somewhat limited to binary content.

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • Basic Binary File Does not Read Unless Placed into Exact Format it originated?

    Ok, check this out.  This just does not make any sense to me.  First, you'll need to run it and create the two files.  You're going to get an error at the close.  Now...here's what doesn't make any sense to me.  If you enable the disabled diagram and read that same file, you can look at how the file is being read and the data interpreted.  How is that any different and not causing an error?  I took the U8 and changed it back to its original Boolean Array[8] format and received no error.  Which means the data was read as a U8 at some point.  But...for whatever reason, cannot be read and displayed as a U8.  What's up with that?  What am I not understanding?
    Remember, code does exactly what you tell it.
    Solved!
    Go to Solution.
    Attachments:
    Binary File Issue.vi ‏23 KB

    DailyDose wrote:
    Huh....no read and write.  Either read or write.  Gotcha.
    Not quite.  It is a matter of where the file pointer is.
    The file pointer is what location in the file will be read from or written to, depending on what you do next.  When you write to a file, the file pointer is set to be directly after what you just wrote.  So when you write a new file, the file pointer is at the end of the file.  So when you try to do a read when the file pointer is at the end of the file, an attempt of a read at the end of the file happens.  But there is nothing left for it to read.  Therefore you get an End Of File error.
    So if you just added a Set File Position to set the file pointer to the start of the file, you can read your byte with no error.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Binary File Issue_BD.png ‏25 KB

  • Read doc file using the Word Binary file format

    I want to be able to parse a Word file (xyz.doc).I want to be able to get to the actual text in the file and also get the "document properties" associated with this file.(This is the stuff you enter when you hit the File>>Properties button in Word)
    I have the binary file format of MS word 6.0 and I suppose these "document properties" are stored within a segment in this file format.
    Can anyone help me identify which segment in the Microsoft Binary word format this will be in???
    (Ya and ofcourse I want to achieve all the parsing purely in Java!!..)
    Thanks,
    Supriya

    IF you use MFC, yes. Don't ask how, this is the Java
    forum. As to the JAva API, no. There is no API in Java
    to deal with Microsoft docs, this is Java, not
    Micorsoft. Ya I know that!!:P
    You can write your own code, using the
    information in the doc. The info you refer to is
    locted on the header portion. As to how to read it,
    best go to a Microsoft forum. Once you understand the
    format, then post any Java related questions here,
    i.e. how do I oppen a file to read/write etc. Good
    luck, you will need patience, but you will leran a
    lot...Thanks anyway for your reply!:)..Will try with patience

  • Labview binary file format, reading in matlab

    Hi,
    I have some binary files that I wrote in Labview containing data of type double.  I'm trying to load the data in Matlab but I am not having much success.  In Matlab I am using the fread command and specifying the type as double with the machine format as 'b' for big-endian.  But the values I get do not make any sense.  Does anyone know what format Labview saves the data in?  Is it big-endian?  Or something else?
    Thanks,
    Todd

    LabVIEW stores data in BIG endian format. This was done to maintain compatability between all of the different platforms that LabVIEW runs on. And of course is an inheritance of the original Macintosh LV versions. There is a shipping documents that presents all the data storage formats. Just do a search in the LabVIEW bookshelf.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

Maybe you are looking for

  • How do I add an area code to a phone number after clicking number in text message?

    Some people send 7 digit phone number in emails and text messages, and I need to add the area code to the front of the number, or else AT&T will choke. I have not found a simple way to do this. Current method: copy number to notes, add area code, the

  • Help with small program

    hey every time i compile i get errors with the JOptionPane.showMessageDialog(s) in the switch statement any help would be great ""incompatible types found : void"" here is the code import java.util.Random; import javax.swing.*; public class Fish{ Str

  • 6301 & PC Suite - "Data transfer not possible. Che...

    Well, as the title says really. Upgraded from 6280 -> 6301. I use Outlook 2003 and sync contacts & calendar. Sync'd the 6280 before finalising upgrade, plugged in the 6301 with a mini-usb cable (All driver reports it installed new hardware fine) once

  • Help Converting Excel Time( Function to DAX

    I have a column of data that has a text string that represents a time of day.  Example if 55553 which is 5:55:53 AM. I need to convert the time to Eastern, and display in a time format.  Here is the formula I am currently using in Excel: =(TEXT([Time

  • SAP ECC 6.0 on Linux  OS

    Hello to all,                 I'm new to SAP world and would like to install SAP ECC 6.0 SR1 or SR2 on linux platform with Oracle as Database. I'm not sure how to search for software into the market place, what are the notes to refer. Would be great