LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our General Code Repository Files. Also, before posting here, check to see if your post doesn't fit into another subforum by category.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Scan From String Woes, scanning enums
Michael_Aivaliot...
post Jan 14 2004, 02:09 AM
Post #1


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2367
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE
> Perhaps it’s just me, but I find “Scan from String” to be quite quirky.
>
> It seems to work for some configurations and then does not on others. I am
> ‘casting’ Enum rings into strings using the “Format into String” adding a
> comma then adding the numeric value of the Enum.
>
> So the string looks this: “240W, 5”  (The 240 ’W’ is actually the ohms
> symbol – but it appears as a W in system font)
>
> I have several other snippets of code successfully scanning
> similar strings
> with enumns back using the “%s,%d” then using a constant of the
> enum as the
> prototype for the first output node. But this particular message – won’t
> parse (ERR 85 in Arg 1). The Enum is not Strict type Def. nor are the
> others.
>
> If you read the help carefully, you can define the string
> handling by using
> the top “format String” node OR by connecting the correct default
> data type
> into the “Default Value” nodes. Even doing by defaulting the
> nodes – it can’
> t decode the string – it seems to fumble over the ‘W”
>
> I guess I’ll use the old tried and true “Match Pattern” which is more
> reliable.
I'm having a hard time trying to piece together what you are trying to do. I think I've got it in the attached image. If i'm wrong then please upload an example. Also, Here is what the help actually says:

QUOTE
default 1..n specifies the type and default value for the output parameters. If the input value cannot be scanned from the string, the Scan From String function uses the default. If you leave default 1 unwired, the type of the output is determined by format string, if format string is a constant. Otherwise, the default data type is double-precision, floating-point. The default value is zero or an empty string, depending on the output data type.

Attached thumbnail(s)
Attached Image
 

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Jan 14 2004, 02:09 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
JackHamilton
post Jan 14 2004, 03:35 AM
Post #2


Very Active
***

Member
Posts: 124
Joined: 17-January 03
From: Southern California
Member No.: 37
Using LabVIEW Since:1988
LV:8.0.1 ,. ,.
United States United Kingdom Nothing Selected


Mike,

You have it correct. And I have several places in my code where is does work. I've only come across this one instance.

Match pattern is working for me. Scan from String is sometime too strict in it's parsing I've found.

It did save my bacon where I had to parse a Binary string. Scan %8b worked great.


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Michael_Aivaliot...
post Jan 14 2004, 07:06 AM
Post #3


Confucius say: Crowded elevator always smell different to midget
Group Icon
*****

Admin
Posts: 2367
Joined: 13-October 02
From: Planet Earth
Member No.: 2
Using LabVIEW Since:1994
LV:8.5 ,8.2.1 ,7.1.1
Greece Canada United States My Blog My Gallery


QUOTE (JackHamilton @ Jan 13 2004, 10:35 PM)
Match pattern is working for me. Scan from String is sometime too strict in it's parsing I've found.

Just be carefull when using Match Pattern. Sometime you forget about special characters that are used in the regular expression input. See example:

As you see we are looking for \b and can't find it since it thinks we want the backspace code. Of course this can be ignored by using \\b but you should be aware of this especially if your regular expression is programmatically generated.
Attached image(s)
Attached Image
 

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 2nd December 2008 - 12:45 AM