From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to find a string different of "off"

Solved!
Go to solution

I have an array of strings and I need to know the index of anything that is different of the string "off".

 

The function Search for 1D Array can return me only the index when find something, and not the index of the string that is different of this... Is there any function for that?

 

For example, I can have an array like (off, off, off, standard), and I need the index 3 for the string standard.

 

Thank you,

 

Thais

0 Kudos
Message 1 of 12
(3,078 Views)

You could use the conditional loop terminal if you have LV2012.

(right click on the loop terminal > Tunnel mode > Conditional)

conditional.png

0 Kudos
Message 2 of 12
(3,069 Views)
Solution
Accepted by topic author thsmarques

Just re-read the question and realised you want the index:

index.png

Message 3 of 12
(3,068 Views)

something like this should work

 

Non Existing index.png

 

Find index non elements.png

 

good luck

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 12
(3,063 Views)

Hi,

 

how about this try..

LV 8.0, 8.6, 2011,2012,2013 WinXP
0 Kudos
Message 5 of 12
(3,055 Views)

You can still optimize (just for fun)

 

 Index_Subbzz-1.png

 

index_subbzz-2.png

 

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 12
(3,052 Views)

P@Anand wrote:

You can still optimize (just for fun)

 

 



Watch out, in your case selector Off use a capital "O".

 

Ben64

0 Kudos
Message 7 of 12
(3,029 Views)

@ben64 wrote:
Watch out, in your case selector Off use a capital "O"


... unless the case is configured for "case insensitive match" 🙂

Message 8 of 12
(3,020 Views)

@altenbach wrote:

@ben64 wrote:
Watch out, in your case selector Off use a capital "O"


... unless the case is configured for "case insensitive match" 🙂


Thanks for the tip, actually I never realized this option exist.

Ben64

0 Kudos
Message 9 of 12
(3,012 Views)

And how exactly do you tell from looking at the code whether or not it is Case Insensitive?  (In the snippet it is not.  Smiley Wink ).  The answer is, you can't.  It really cheeses me off when I have to resort to a right-click menu to determine how a piece of code is going to behave.

 

If it were me I would ditch that option.  That might be too hardcore for some, so at least make it obvious via a glyph or something what the behavior is.  I never use it, instead I drop a To Lower Case before the Selector.

0 Kudos
Message 10 of 12
(2,998 Views)