04-19-2012 10:03 PM
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 ?
04-20-2012 04:59 PM
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.
04-20-2012 05:05 PM
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?
04-23-2012 10:54 AM
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.