Wrong use of "Scan From String" function in a while loop?

Hi,
I've got a "Scan From String" function inside a while loop. On the first iteration it converts correctly the number passed by the input string (for example 4) But on the second one it has only spaces (one or more \s) as input string.
I expected to obtain a zero as output (as it does always that it can not make any conversions, as I am supposed to) but indeed, i subtracts 1 from the previous number (according to the number indicated as example I would obtain a 3 as output)
What's wrong with this?
Does the function fails on this case?
The rest of the diagram o the VI is expected to manage a 0 on that situation, like others in which the conversion is not made.
Andres.

I have simplified the VI evading calls to other VIs and trying to reproduce the mistake.
The type of string I introduce to reproduce the mistake is:
clock 3 (30) clock (40)
Forgetting to introduce a number between the second "clock" and the following parenthesis, I would manage it programmatically with code that isn't included.
Then "Scan From String" is supposed to do not make a conversion. But it leaves a 2 as output (in this example)
I have realised, unbelievable but true, that it has matter with the number I substract to the output number (if it were 2, I would obtain 1 as output and so on)
Excluding that, I got the conversion made before as output, 3, on the second time that "Scan From String" executes. But, how can this func
tion as bad?
I am using LV4 on an old PC. I have tried to reproduce it with LV6 and it works. But it isn't desirable for me, I would have to convert a lot of VIs and surely I will find a lot of errors due to the conversion (I have already tried)
Attachments:
EXTCLOCK.VI ‏26 KB

Similar Messages

  • Is there a way to scan a string containing % (percent symbols) using the "Scan from String" function?

    I am communicating serially with a chilled mirror device and the input string syntax contains this text: "%RH=<input value>"
    I have not been able to figure out how to tell the function that the percent here is not a format specifier. Is this possible, or should I just try to use a different function?
    Thanks.
    Mitch
    Solved!
    Go to Solution.

    Use %% in your format string so that it knows to use the percent literally.  So %%RH=%f
    EDIT:  Darin got one in there ahead of me.  It looks like either \% and %% both work.
    Attachments:
    Example_VI.png ‏10 KB

  • Get string inside brackets - Using Scan from string

    I have a very basic question here. I would like extract a portion of a string which is inside brackets (Example: I work with [National Instruments]). In the string I only want to extract National Instruments, I do know logic to extract by finding the brackets and extracting them. But I am interested in using the Scan from string or possibly any other primitive in one shot. Please suggest if anyone has any idea, I am really not use to the format specifiers. I got this link for reference but I am not able to figure out a solution.
    The best solution is the one you find it by yourself
    Solved!
    Go to Solution.

    Hi,
    I cannot say that it is the best solution, I use two Scan From String functions instead of one but it does work, so far ;-)
    I use Characters in set.
    I could not attach VI so FP is below.
    Duri

  • Scan from string in pda

    Hello. 
    I work with LV 7.1, with the I Modul of PDA. 
    It doesn't work me 'Scan From String'. I have not found any contradiction because the pda doesn't accept it. 
    Does somebody know which the cause can be? As I can substitute it? 
    Thank you. 
    Greta
    Attachments:
    scan from string.JPG ‏6 KB

    Hello Greta
    The Scan from string function is supported in LV PDA but with some restrictions. The help file for LV PDA tells us:
    'The Format Into String function and the Scan From String function do not support changing the numeric separator (such as %#;). The Scan From String function does not support wildcard matches.'
    You are changing the numeric separator and this is not supported.
    Hope this helps
    BelenS

  • Scan from string with %g - result not accurate

    I am trying to use the "Scan from String" VI to convert a string into a number.  I am using "%g" as the format specifier.  The conversion is only grabbing the first six significant digits, yet I need it grab all significant digits.  Is there a real limitation here?  What could I do to solve this issue?
    I have attached a simple VI to demonstrate what I'm seeing.
    Thanks,
    Joel
    Attachments:
    Scan_from_String_Example.vi ‏7 KB

    It is because the display format for your numeric indicator is set for 6 significant digits.  Adjust the display format for the indicator and you will see that the other digits are there.

  • Scan from string

    Trying to use the Scan from String VI to break apart a string. How does one get it to accept strings with blanks embedded?
    Solved!
    Go to Solution.
    Attachments:
    Untitled 2.vi ‏7 KB

  • Using scan from string to convert a string into a number

    I wanted to use scan from string to change a string into a decimal number, but when the string is, for example, 9.14123E-2 it just returns 10. How can I get it to return .00914 or 9.14E-2(as a number not a string). Would there be something easier than scan from string? I'm using labview 5.1. Thank you!

    Hello,
    May be you can checkout the attached example.
    Perkash Mohan Lal
    Institute of Semiconductor Technology
    Technical University Braunschweig
    Attachments:
    string_conversion_1.vi ‏44 KB

  • Using scan from string

    Hi
    I am reading a string from an instrument in the format hr:min:sec, 0.000, 0.000, 0.000,0.000
    I need to separate each part and add it to an excel file. I have triend scan from string and
    string subset. I am unable to use scan from string as the first output is in different format than the others.
    I cannot use string subset as the value changes to a negitive value sometimes which makes it difficult to get the right string lenght.
    Can someone help me in figuring out the best way to split the string and add to an excel file
    Thank you in advance
    Raghu
    Attachments:
    pressure sensor.vi ‏27 KB

    Here is the screen shot after I ran the vi. Along with copying the data to an excel sheet I need the individual data to use in my program later.That is the reason I wanted to parse the string.
    Thanks,
    Raghu
    Attachments:
    string.JPG ‏153 KB

  • Reading 16 & 22 bit signed integers using Scan From String

    Last week it was suggested to use Scan from String which is a new tool for me and worked well to be able to read in ans parse strings.
    After parsing the string, I'm having trouble converting the numbers into signed integers. The magnitude of some of the the outputs are unreasonably high then flip to near 0 then back up again.
    Sample String (With spaces added)
    $ 00 FCCE 00F6 3FFA93 0BFE 0C89 0DDB
    Message Format:
    Bytes 3-6 FCCE Heave acceleration bits 15-0 15-bit data, sign extended to 16 bits LSB : 0.001261g Sign “+” when accelerating upward
    Bytes 11-16 3FFA93 FOG Gyro 1 bits 21-0 Bits 22-23 are always zero 22-bit signed data LSB = 97.275 µ˚/s Sign corresponds to MEMS axis
    Sample Data File:
    $00FCCE00F13FFD78100910A811FA
    $00FCDF00F13FFCD3141614C71619
    $00FCD600F33FFD20182118E61A39
    $00FCDA00F73FFB3E1C2D1D051E58
    $00FCDD00F73FFC32203921242278
    $00FCDD00EF3FFDDC244525442697
    The vi and a longer sample data file are uploaded to the ni ftp site. The zip file is named: IMU (9-15-08).zip. (Can't attach files to this message for some reason)
    Any help appreciated.
    Thanks,
    Chris

    Files uploaded to the "incoming" directory cannot be downloaded. That folder is intended to be used for submitting code to NI to investigate bugs and such things, not for forum posts.
    What are you expecting FCCE to be? If the string is made of the characters "F", followed by the character "C", etc. (as opposed to the hex value of F, followed by the hex value of C, etc), then you can simply use Hexadecimal String to Number. Otherwise you need to use Type Cast.
    Attachments:
    Example_VI.png ‏5 KB

  • Scan from string error 85

    Hi Everybody,
    I'm trying to use LabView to
    process some data.  The data, although it was collected via labview,
    has been written out to csv file format.  I have been able to
    successfully open the file and use the search split string function to
    remove the "header" from the data stream.  Now I'm trying to parse the
    header to extract some pieces of the info that is there.  I'm trying to
    do this with the Scan from String VI.  
    So
    far I've been able to retrieve the Specimen ID from the first line of
    the header by setting the format string input of Scan from String as
    "Specimen ID ,%s", which works just fine.  Problem is, when I
    adjust
    the format string to include the next piece of data I want, I
    inevitably get an Error 85, which is a failed scan.  In fact, I
    get an err85 every time I try to extract something from after the
    second line.  I've attached a VI in which I cut and pasted an
    example header string in as a string constant and an example of how I'm
    trying to extract the values.  I've tried playing around with
    spaces and different formats, but get the err85 no matter what I do
    (unless I extract the first line).  I have a hunch that it has
    something to do with the EOL marker, but no idea how to work around it.
    A search of posts here show that a lot of people have issues with the
    scan from string vi, but nobody I could find had this exact
    problem.  I've also considered using the spreadsheet spring to
    array function, but because I have a mix of commas and EOLs it doesn't
    seem to work either. HELP! I really don't want to have to write this
    over in VBA/Excel.
    Thanks,
    Turk
    Message Edited by YoungTurk on 07-29-2005 10:36 AM
    Attachments:
    Scan.vi ‏12 KB

    You should probably parse it line by line (See attached, LabVIEW 7.1)..
    The attached example shows one possibility to get all the Items and values out. Not all values are strictly numeric so you would need to adapt the code a little bit. (This is just a very rough 1 minute draft).
    You might want to cosider to extract all values into a cluster for further processing, Have a look at the example  posted in this thread . It can be easily adapted to read the values in the proper format (DBL, I32, Date, String, etc.) depending on the item name.
    Good luck!
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ScanMOD.vi ‏30 KB

  • Scan from string and extract string between delimiter

    Hello,
    Basic questions.  Is it possible with the scan from string regular expression to extract the string that are within the specified delimiters.  Here is an example:
    \\Name of folder 1\Name of folder 2\Name of folder 3\File Name
    Can the scan from string output the following by specifying the right regular expression:
    Name of folder 1
    Name of folder 2
    Name of folder 3
    File Name
    I have tried \\\\%s\\%s\\%s\\%s but the %s stops at the first white space.
    Thanks,
    Michel
    Solved!
    Go to Solution.

    RavensFan suggested the appropriate function for your requirement, however you can also use an alternative, which is 'Spreadsheet String To Array'.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Interesting scan from string error

    Got an interesting (and hopefully easy) issue with scan from string. VI and back panel image attached. Open it or make it and try to run it and let me know if you get an error too. Am I doing anything wrong?
    (BTW, ignore the %d in the scan from string. You can change those to %f or %g and it still burps)
    Message Edited by mlang on 07-21-2008 09:04 AM
    Attachments:
    ScanFromStringError.JPG ‏27 KB
    ScanFromStringError.vi ‏14 KB

    "JB" <[email protected]> wrote in message
    news:[email protected]..
    > Wiebe@CARYA a écrit:
    > Try "%[^,],%d,%d,%d". %[^,] scans all characters that are not ",".With
    this unique format specifier for Format Into String and Scan from String, an
    error will appear if the input string contains a comma or is empty (the last
    case is also true with the original code). Distinct specifiers may be needed
    to avoid this.
    Yes, comma's might not be the best seperator. It will also fail if the
    numbers use "," as seperators (as is often the case in Europe)...
    But the same can be said for any seprator... If you use tabs as seperator,
    the parsing will fail if the string contains tabs...
    Regards,
    Wiebe.

  • Scan from string error

    when l test the function of scan from string. Why will have this error?

    The lesson here is that a %s does not know where to stop.  It will just take the rest of the string.  Using the %[^.] will grab a string up to a found period (not including the period).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Day of year bug - format date/time string and scan from string?

    I've noticed that the day of year returned by "Format Date/Time String.vi" starts with a value of 1 for Jan-1 while "Scan from String.vi" wants a 0 index.  Is this a bug or feature?  
    (I'm using Labview 2010 Service Pack 1)

    I think the best idea is to use seconds since for your arithmetic, because it is going to be the most consistent and robust solution. Knowing that a day has 86400 seconds is all that is needed and you won't run in possible inconsistencies with date time implementations caused by our anything but logic calender. I would hazard that the functionality of converting a timestamp into year and day of year and back is impossible to make consistent without sacrificing other possibly conflicting transformation in the Timestamp into String and Timestamp from String manipulations.
    "Seconds since" being the actual base unit in all LabVIEW timestamps, it is best to do any arithmetic on it in this base unit.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • "scan from string" to timestamp doesn't work for 18:00:00 (6PM)

    I just found a strange issue in LabVIEW.  I hope I'm doing something silly, but I just may have found an unusual bug.
    run the snippet below with the following for the input string: 03:00:00,18:00:00,17:00:00
    Time converts fine for just about any other time EXCEPT 18:00:00 (6 PM) for which it is returned as 00:00:00 (midnight). If you even add a second to it (18:00:01) you get back the expected result.
    Here's hoping I'm not loosing my mind
    Matt Holt
    Certified LabVIEW Architect
    Solved!
    Go to Solution.
    Attachments:
    TimeParseBug.vi ‏11 KB

    As annoying as it may seem, this exact scenario is an abuse of the timestamp. A timestamp is meant to be used for absolute times. And that includes a date. As Ravens Fan already pointed out, the 0 seconds since January 1, 1904 GMT is used in all timestamp display routines to mean the canonical invalid timestamp and hence the timestamp control displays the default string indicating the actual date/time format rather than a specific date/time.
    If you need an absolute timestamp, for instance because you do want to have a local time indication, although the date is not relevant, adding an offset of 86400 to all values would fix it once and for all. Now the timezone offset can't cause the timestamp to reach 0 ever, even if you reside west of GMT, and it will be fine (until you start to do timestamp arithmetic that involves subtraction of relative timespans, then you would have to make the offset big enough that this will never get an issue). The current date would serve as a nice offset for that, which would be MattH's last suggestion. Nice to see that the Scan from String routine actually does use the passed in timestamp as default value and only replaces the values it is configured to parse.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • Flash won't install- any ideas?

    I am trying to install Flash 11 on my Windows 7 system using IE 9.  I had an existing Flash 10.  I uninstalled Flash 10.  My installation times out at 12%. I have disabled my firewall and virus software.  Still quits at 12%.

  • Using macromedia flex in web dynpro

    how can i use flash object in web dynpro for displaying charts instead of using the webdynpro default charts . i want to use from NWSD not through the portal ..

  • FTP to external system

    Hi, I am try to establish a connection to the external system. I am using the FM "FTP_CONNECT" for connection in my ABAP program. But somehow I am not able to connect. I am getting an error message saying "Attempting to connect to (HOSTname) fail". I

  • Px4-300d empty shares after rstart

    Hello, i'm having a MAJOR issue with a PX4-300D unit in which all shares ARE EMPTY. unit has been working nonstop for 2 weeks, already running latest 4.0.6.19294. It has 2 volumes, each one with different shares(and different snapshot). I needed to a

  • I am trying to locate a phone, but it keeps telling me its offline.  What does that mean?

    I am trying to locate a phone, but it keeps telling me the device is offline.  What does that mean and why won't the phone track.