How to read continue binary string

Hi,
I have a encoder and it send me a continue string in ASCII. The port configuration is : 1 start bit, 7 data bits, 1 parity bit, 2 stop bits and termination character = x0D . And, the code is like this :
ASCII code 31 (011 0001) = SB 1000 110 PB SB SB
My problem is I can not cut the string at the good place.
Thank you for your help.

To find the termination characters, there are a number of vi's
available to use such as "Search and Replace String", "Search/Split
String", or "Search and Replace Pattern" as those all return an offest
number where it has found the termination character.
In order to reverse the sense (with the possibility of having 15 people
find more efficient ways to do this like yesterday), use "String to
Byte Array", then "Reverse 1D Array", then "Byte Array to String", and
your data will be reversed.

Similar Messages

  • How to read labview binary files in Matlab

    I would like to read Labview binary files with Matlab. I read some articles of the subject and I am more interesting in know how labview store this data into file. What is the format use by Labview to store this data?
    Any help is appreciated,
    Hernando

    The term "binary file" means that the data on disk is a (pretty close) duplication of the binary format of the data in memory.  For example, a String will appear as an array of Bytes that, if looked at with a text editor, would be "human-readable".  
    An I32 or U32 integer would take 4 bytes, but the order (or "Endian setting") can be Big-Endian or Little -Endian (and I won't confuse both of us by trying to say which is which).  Thus the number "1" would appear as four byte of 0, 0, 0, 1 or 1, 0, 0, 0.  Floating point (Dbl) also has an "Endian" consideration, but the numbers are encoded as a mantissa and exponent, with sign appearing somewhere.  However, if you get the Endian and precision (Sgl, Dbl, etc.) right, both MatLab and LabVIEW should be able to read each other's data.
    Be careful with Booleans.  It wouldn't hurt to do an experiment and see how many bits/bytes are used for simple Boolean data.
    One other "gotcha" -- in LabVIEW, you can prepend Array and String writes with a U32 that is the length of the Array/String -- you obviously want to take this into account.
    Something that I've found helpful when dealing (in both Matlab and LabVIEW) with "unknown" binary data files is to use an old-fashioned "binary editor", something capable of displaying a file as Text and Bytes.  Strings "stand out", and if they seem to be preceded with 4 bytes that are mostly 0 with one Byte more-or-less the length of the String (sign that String Length was prepended).  If you see a lot of byte data that look like they could be 2 or 4 byte integers, they probably are.  If they are four bytes of numeric data that have few zero bytes (i.e. if most of the 32 bits seem to be used), they may well be floats.  Make a guess at the format and write a short routine to read according to your guess -- do you get meaningful data?  Go ahead, be a Scientist, not an Engineer -- study the data, form a hypothesis, then design and do an Experiment and see if you need to reject your hypothesis ...
    Bob (Neuroscientist) Schor

  • 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

  • How to read date as string (format dd-mm-yyyy) and store it as Date object

    Hi. I would like to read from keyboard String with a date and put this value to Date object. How can i do this???
    Thanks

    Check out java.text.SimpleDateFormat.
    Basically
    String dateString = readUserInput(); // get the string
    SimpleDateFormat myFormat = new SimpleDateFormat("dd-MM-yyyy");
    Date myDate = myFormat.parse(dateString);

  • How to read in text string pairs from an external txt file?

    I have an external txt file containing 26000 pairs of strings in the format
    string1a   string1b
    string2a   string2b
    string26000a string26000b
    all strings are always 4 characters in length.  For example,
    a123   jkdh
    b456   uusp
    How can use TestStand 2013 to input this data into local string array varaibles?  I also have legacy testers running TestStand 3.5, so I need a TestStand 3.5 solution as well.  Thanks in advance for any ideas.  Hopefully this can be done in TestStand without the use of LabView or LabWindows/CVI.

    Daniel E., thanks for the reply. 
         It is very frustrating to have to implement workarounds in order to access text in an external file when using TestStand.  TestStand already reads in text ini files, so it would probably take a TestStand software developer all of 1/2 day to write the code and 1/2 day to debug it.  Here I will restate the obvious.  Engineers have to deal with data, sometimes data generated from other applications.  Sharing data in a text file is one of the most basic functions (and one of the easiest to implement).  When I think of all the effort needed to support ActiveX, but NI did not see it fit to give TestStand users simple text file read/write functionality, it does not make sense to me.  Maybe it was too simple or mundane a task so it did not get developed?  Whatever the reason, I think users of TestStand deserve this basic functionality.
         Even if TestStand cannot read the data directly into array variables, it should provide some mechanism to read the text from the file, either line by line or all file text into a string, so the data could then be parsed into the array variables I need.
         I will pursue a CVI or LabView solution.  Please also know that I am not directing these comments at you, I do appreciate your reply.
    Regards,
    Ron

  • How to read excel binary file in ABAP application server

    Hi Gurus,
    I have to read business partner data from the binary format of an excel file in application server. I searched in forums but only found solutions about using ole2 objects, but in ABAP application server there is no excel APIs, so I have to read binary directly. You know it is rather difficult, do you have any clues or sample function modules? Thanks!
    Best regards,
    Hao

    Hi Deng,
    I think there are two possible solutions:
    1. Get the file created as tab-delimited or CSV as recommended earlier
    2. Excel files are BIFF (Binary Interchange File Format). The Microsoft office 97 developer kit has tools for analysis and access. You may search for existing interface software or create your own ABAP code. Publish it on SDN and win great merits.
    Regards,
    Clemens

  • How to read/convert hexidecimal string to an interger

    Hello everyone,
    This is probably very simple but non of my books show what I need to do. I am running Java 1.4.2 and not ready yet for 1.5.
    I wanted to read Property entries containing hexidecimal entries and then convert the hexidecimal entries (which are in String format) into a number either int., long,double or Interger.
    Property entry:
    address=0x06FE
    Property prop = new ....
    String addr = prop.getProperty("address");
    Interger num = new Interger.parseInt(addr); <---- fails
    Would appreciate your help
    Regards,
    Ulises

    Integer.parseInt(addr, 16);
    //or
    Integer.valueOf(addr, 16);
    Note that you should call the method by the classname, as it's static. Do n't try to do new Integer as you're doing.

  • Mail Excel as attachment with input as binary string

    Hi Experts ,
    I want to design BAPI which will have one string as import parameter.
    I will get binary data in this string.
    Now i want to mail this binary data string as excel attachment.
    Anyody knows how to convert this binary string to internal table and then send this as attachment?
    Thanks & Regards ,
    JIgar.

    check these sample programs
    BCS_EXAMPLE*

  • Scan arrays from binary string

    I have TCP connection that is sending a great number of fixed size arrays that I need to convert. Is there a simpler way to do that than the one I have attached?
    Attachments:
    Scan from binary string.vi ‏16 KB

    Sorry, I didn't write my question clear enough.
    I know how to do TCP data transfer. I also know how to unflatten the binary string back to data, but I was hoping there was a clearer way to do it than the way I suggested. For scalar values one can make a cluster containing the data in the binary string and only one "unflatten from string" is needed.
    However, if the binary string is composed of arrays (even though they are fixed in size) I need one unflatten string for each array. In my case I have many small arrays. The attached example with only three arrays was only to illustrate what I wanted to do.
    I have now found a way using a cluster of clusters. I don't know if this is the ideal way of doing this, but it works, and when enabling "view cluster as icon" I can make the code much more compact and easier to read
    Attachments:
    2012-07-04_120216.jpg ‏385 KB

  • How to Read the Digital Signature in PDF's.

    I want to read the digital signature in PDF. Is this possible?
    I dont know how could read the sign. I want to read and store into the database using vb6 form.
    Is possible to read the digital signature in binary format?
    Please tell me how to read whether binary or any other... I want to read and store into the database.
    Please help me
    This all i need to done in vb6 application.

    This all i need to done in vb6 application.
    For information about questions relating to VB6, please see here: 
    VB6 and older

  • How can I read a binary file stream with many data type, as with AcqKnowledge physio binary data file?

    I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
    leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
    llustrate it.
    Many thanks in advance for your help.
    Donat-Pierre
    Attachments:
    Demo.acq ‏248 KB
    SCR_EKG_test1b.acq ‏97 KB

    The reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
    See the attached example.
    The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Read_AK_time_info.vi.zip ‏9 KB

  • How can I read a binary file stream with many data type, as with AcqKnowled​ge physio binary data file?

    I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFo​rmat.h
    tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.ht​m) .
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
    Many thanks in advance for your help.
    Donat-Pierre

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How can I read a binary file?

    In my AIR application, I'm trying to read a binary file and then post it via an HTTPService to a remote ColdFusion component that accepts a "binary" type argument.  The result of the post is always:
    The FILEOBJ argument passed to the addFile function is not of type binary.
    Here is how I'm reading the file in Flex, where fileObj is of type File:
    var fs : FileStream = new FileStream();
    var bytes : ByteArray = new ByteArray();
    fs.open(fileObj, FileMode.READ);
    fs.readBytes(bytes, 0, fs.bytesAvailable);
    fs.close();
    I then pass "bytes" as the parameter to my HTTPService's send call, like so:
    var params : Object = {method : "addFile", fileObject : bytes};
    service.send(params);
    When I debug, bytes contains the correct file size.  Is it not in binary form?  I've tried several other suggestions, but with the same result, so would appreciate any help.
    Thanks!

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How to read binary file ?

    Hi All,
    I want to read a binary file which has double data. The first byte is an unsigned byte. I have tried using DataInputStream readUnsignedByte method. But then how to convert this value into double.
    int hdop = _data.readUnsignedByte();

    Hi,
    I have managed to read the first byte i.e hdop. I am getting the values of first 2 bytes properly. But the values where I have to read more than 1 byte is creating problem. Can anyone let me know whats wrong in the code?
    import java.io.DataInputStream;
    import java.io.FileInputStream;
    import java.util.Vector;
    public class SBPParser {
         //RandomAccessFile _file = null;
         FileInputStream _file = null;
         DataInputStream _data = null;
         int eofmark = 0;
         public SBPParser(FileInputStream f, DataInputStream d) {
              _file = f;
              _data = d;
         public void parseSBPFile() {
              try {
                        int hd = _data.readUnsignedByte();
                        double douhd = (hd & 0xff) * 0.2;
                        int svid = (_data.readUnsignedByte()) & 0xff;
                        int utcsec = _data.readUnsignedShort();
                        double utcs = (utcsec & 0xff) * 0.001;
                        int utc = Integer.parseInt(utcdatetime);
                        int sec = utc & 0xFC000000;
                        int min = utc & 0x3F00000;
                        int hour = utc & 0xF8000;
                        int day = utc & 0x7C00;
                        int months = utc & 0x3FF;*/
                        int utc = _data.readInt();
                        int sec = utc & 0xFC000000; //For fetching first 6 bits
                        int min = utc & 0x3F00000;  //For fetching next 6 bits
                        int hour = utc & 0xF8000;    //For fetching next 5 bits
                        int day = utc & 0x7C00;   //For fetching next 5 bits
                        int months = utc & 0x3FF; //For fetching next 10 bits
                        int svidlist = (_data.readInt()) & 0xff;
                        int lat = (_data.readInt()) & 0xff;
                        double latitude = lat * 0.0000001;
                        int lon =(_data.readInt()) & 0xff;
                        double longitude = lon * 0.0000001;
                        int alt = (_data.readInt()) & 0xff;
                        System.out.println("Value of Hdop ==> " + douhd);
                        System.out.println("Value of SVIDCnt ==> " + svid);
                        System.out.println("Value of UtcSec ==> " + utcs);
                        System.out.println("Value of seconds ==> " + sec);
                        System.out.println("Value of minutes ==> " + min);
                        System.out.println("Value of hours ==> " + hour);
                        System.out.println("Value of day ==> " + day);
                        System.out.println("Value of months ==> " + months);
                        System.out.println("Value of SVIDList ==> " + svidlist);
                        System.out.println("Value of Latiutude ==> " + latitude);
                        System.out.println("Value of Longitude ==> " + longitude);
                        System.out.println("Value of Altitude ==> " + alt);
                        //_data.skipBytes(31);
              } catch(Exception e) {
                   e.printStackTrace();
         public void print() {
              for(int i = 0; i < hdopVct.size(); i++) {
                   System.out.println("HDOP => " + hdopVct.elementAt(i));
              /*System.out.println("SVIDCNT => " + svidlistVct.elementAt(0));
              System.out.println("UTCSEC1 => " + utcsecVct.elementAt(0));
              System.out.println("UTCSEC2 => " + utcsecVct.elementAt(1));*/
         public static void main(String [] args) {
              try {
                   FileInputStream file_input = new FileInputStream("000000000_GPSLOG_20090605_122548.sbp");
                  DataInputStream data_in    = new DataInputStream (file_input);
                   SBPParser sbp = new SBPParser(file_input, data_in);
                   sbp.parseSBPFile();
                   //sbp.print();
              } catch(Exception e) {
                   e.printStackTrace();
    }Thanks & Regards
    Sunil

  • How to read binary floating point values from TCP/IP

    I am attempting to use a LabView application to read an array of binary single precision floating point numbers transferred through a TCP/IP connection from a Windows C++ program. The endianization occurs before the values are sent to the Labview application. When I read the values in LabView, some values are interpreted correctly, some are not. For instance, the C program is sending a 6 as one element, and 7 as another. Labview interprets both as 6. The difference between 6 and 7 in binary format is 1 bit (bit #21 if counting from 0 in LabView format). There are 2 other values that show the same error- 459.67 is being sent, 395.67 is read by labview (1 bit difference, exact same bit... 7.5 is being sent, 6.5 is being read by LabView (1 bit difference, exact same bit). LabView reads that bit as 0, when it should be 1.
    This seems very odd to me because most values are being read correctly, including other values with that same bit on. There are values being read correctly that are both before and after the incorrect values in the array, so it's not just an issue with an offset or something in the bit stream. Additionally, when attempting to read an array of values with all bits on, I get a strange pattern of 111110011111100111111001111110.
    We have also verified that the binary representation for the values is the same on both machines, once you account for the byte swapping. What am I missing here? How in the world can some values come across correctly and others incorrectly? Any help would be greatly appreciated! Our fallback is to transfer everything in ASCII, which is going to greatly increase packet sizes.
    Thanks,
    Jason

    Update:
    Problem fixed. I say fixed and not solved because I don't know why it's fixed. I had been storing the TCP/IP read in a string and passing it through a shift register after each read. I would then concatenate it with the TCP/IP read result in the next loop. After each read, it would search the concatenated string for ASCII flags. When it found them, it would strip off the flags and then type cast the rest as single precision floating points.
    I knew I would be getting the same number of bytes each time, so I ditched the ASCII flags and had just the binary values sent. This way, I expect to get all of the values in one TCP/IP read. No values are passed through a shift register to the next loop and there is no concatenation of the string outputs from TCP/IP read.
    I'm not sure if it was the ASCII flags being included or something with the way I was manipulating the string that was causing the binary values to be interpreted incorrectly. Hope this helps someone else.
    Jason

Maybe you are looking for

  • A way to display error messages from the program

    Dear all, I am looking forward to display a set of error messages(in a internal table) during the execution of the program to the user. I wanted to know the better way of displaying error messages from my program with more options. Well I tried out u

  • Differences between Oracle 9i and 11g

    Hi, We are planning to migrate various PLSQL objects from Oracle 9i to Oracle 11g. We have around 200 packages and Staored procedures Oracle 9i, can some one let me know if there are any specific items to look before we migrate from Oracle 9i into 11

  • Portal.wwdoc_document  Access

    Hi all, I am trying to write a SQL script that I can use in conjunction with Oracle Reports (Portal). I want this script to show all new documents uploaded by anyone in a page group. When I run the script from my Desktop app, I see everyone’s documen

  • MISSING PLUG-IN HELP!!!

    When I try to download most things (Skype, Spotify, etc.) it says "Missing Plug-in" but not what I'm missing.  I've had this problem for about a year or so and I've emailed many support websites and asked other Mac users (who never have this problem)

  • ITunes Match/Storage Issues

    I have a 16 GB iPhone 4, and I recently purchased iTunes Match, hoping to clear up some space on my phone to download iOS 7, since my music would now be stored in the Cloud.  Now, when I plug in my iPhone to sync, it says that I have 8.9 GB of music