Jump to content

LV2010 weirdness


Recommended Posts

From the LabVIEW Help:

For numeric ranges, specify a range as 10..20, meaning all numbers from 10 to 20 inclusively. You also can use open-ended ranges. For example, ..100 represents all numbers less than or equal to 100, and 100.. represents all numbers greater than or equal to 100.
For string ranges, a range of a..c includes all strings beginning with a or b, but not c. A range of a..c,c includes the ending value of c.

Not a bug.
  • Like 1
Link to comment

How does that explain string 2 being "z" ? The two results appear to be contradictory... According to the help, String 2's result would appear to be a bug...

But I'm still wondering: why would they make string ranges non-inclusive? In what case is it useful? Considering numeric ranges are inclusive, this really seems to be counter-intuitive.

Edited by Samapico
Link to comment

Sorry, I was explicitly referring to the "inclusiveness" in terms of whether it's a bug or not. You seemed to be implying that the non-inclusiveness is a bug. In actuality, the bug is that in the second case, LV 2010 is not behaving correctly. When you wire in a constant it does one thing, but when you wire in an output of a string function it does something else. That seems to be a compiler issue. In LV 2011 it behaves correctly, i.e., according to the documentation. You may disagree with it, but that does not make it a bug. ;)

I do not know the reason why the string range was made non-inclusive. That's something you'd need to ask NI. You can always lobby to have the behavior changed by posting an idea in the LabVIEW Idea Exchange.

Link to comment

Just slap an 'Always Copy' node after the constant in the second case and it is all good (LV10). They should probably change the icon of that function to a band-aid. (Of course the number of places you need this is supposedly declining, but it is still good to know for those of us stuck with old versions).

Link to comment

From the LabVIEW Help:

For numeric ranges, specify a range as 10..20, meaning all numbers from 10 to 20 inclusively. You also can use open-ended ranges. For example, ..100 represents all numbers less than or equal to 100, and 100.. represents all numbers greater than or equal to 100.
For string ranges, a range of a..c includes all strings beginning with a or b, but not c. A range of a..c,c includes the ending value of c.

Not a bug.

Thanks. I guess it's just one of those things where you never actually read the docs, because you use the thing every day.

Br, Mike
Link to comment

Who knows, maybe NI meant it to work that way. Inquiring minds would like to know...

For better or for worse (separate discussion), LV has no notion of a 'char', only strings or byte arrays. The selector has to be interpreted as a string, and therefore one of the limits must not be inclusive (upper one makes slightly more sense). Otherwise you would sometimes need to write the "biggest" string which starts with b, is it bzzz or bzzzz or bzzzzz.... This is also what currently precludes floats from the selector.

I wish we could specify the inclusiveness of either bound using standard '[' versus '(' conventions. You could then write ["a".."c"] or ["a".."c") or ("a".."c"]. This would also allow floats to be used which would be very cool IMO, you could have NaN, +Inf, -Inf, [0..3), [3..6), cases.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.