LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pick up specific indices from for loop

Solved!
Go to solution

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 ?

0 Kudos
Message 1 of 6
(2,415 Views)
Do you want to do something different for each value? You can simply wire in a case statement.
0 Kudos
Message 2 of 6
(2,409 Views)

no , i want to do the same thing whenever that index happen , i just want to change a boolean variable . case structure is a good one but i wonder if there is a mathmatical way to do it ?

0 Kudos
Message 3 of 6
(2,402 Views)

Not a formula, but here's one way to do it:

for_index.png

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 4 of 6
(2,392 Views)

Why would you need a mathematical formula?

 

What is a "boolean variable"? In the context of LabVIEW, you need to explain in more detains what you mean ;))

 

I would just do something similar to the following (The second loop will iterate 60 times):

 

 

Note that the parts on the left will be folded into a single boolean array constant at compile time, so there is no overhead during execution.

 

(You can also do it all in a single loop. try it. ;))

 

 

Message 5 of 6
(2,391 Views)
Solution
Accepted by topic author bmemq

Hi,

 

Try this..

 

Regards,
Nitz

(Give Kudos to Good Answers, Mark it as a Solution if your problem is Solved:smileywink:) 

Message 6 of 6
(2,383 Views)