Cart | Help
 You are here: NI Home > NI Developer Zone > NI Discussion Forums Select Community English Français Italiano 日本語 한국어 Español 简体中文 繁体中文 Português (BR)

Member
Posts: 11

how to pick up indices for a for loop

hi guys ,

i have a for loop with N = 60 , i'm trying to make something when the index (i) reachs specific number , the indecies i'm interested in are

1 ,5 , 9,13, 17, 22, 26, ,30,34,38,43,47,51,55,59

the difference is 4 in some of them but it changes to 5 @ 22 and 43 and come back to 4 in between .

can anybody help me pick up these indecies ?

Member
Posts: 79

Re: how to pick up indices for a for loop

Hi bmemq,

What's your application here? It sounds like you can use a case structure and wire the iteration terminal of the for loop to the selector. This will give you a default case as well as a case for what you want to do when the index is one of those numbers that you want.

Josh Y.
Applications Engineer
National Instruments
Member
Posts: 11

Re: how to pick up indices for a for loop

i want to do the same thing when the index happpens , basically change a boolean from T to F , so i'm courous, if i can find a way to check out weather the wanted index come out or not, mathamatically for example?

Member
Posts: 79

Re: how to pick up indices for a for loop

Hi bmemq,

You can do this with the Equal? function found in the Comparison palette. You would have one Equal? function for each index that you're interested in- one input would be a constant of that number and the other input will be the index terminal of the for loop. Next, you can you a Compound Arithmetic found in the Boolean palette. The number of inputs of the Compound Arithmetic can be expanded to match the number of indices that you're interested in, and each input will be the output of an Equal? function. Finally, the output of this Compound Arithmetic will be in the input of the selector in a Case Structure where you will have a true and false case to toggle the Boolean.

Josh Y.
Applications Engineer
National Instruments
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
 My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page