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 manipulate FOR loop in order to have iteration start value greater than 0

Solved!
Go to solution

Hello All!

 

I am looking for a solution where I can manipulate a FOR Loop to start iterating not at a value of 0 but e.g at 201 and continue the loop till the  500.

I am displaying the frame numbers of a video file from 201 to 500 by using a horizontal slider. Instead of the slider starting from 201 to 500, the slider displays the frame numbers from 0-299. In order to achieve this, I want to manipulate a FOR Loop to control the slider.

 

So can someone suggest me how to manipulate a FOR Loop to start the Iteration at 201 and not at 0.

0 Kudos
Message 1 of 17
(3,691 Views)

Hi enthusiast,

 

so you want to add an offset to your iteration count?

Then just do this: add 201 to the iteration count!

 

(Usually a FOR loop will not control a slider, but the slider will control the way the FOR loop works…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 17
(3,680 Views)

Yes, exactly. But , how can I give offset value to the 'i' term of the FOR Loop. It doesn't allow. Can you please show me how? I would be grateful to you.

PS:Below is the attached VI . Check only the State 2.

0 Kudos
Message 3 of 17
(3,674 Views)
Solution
Accepted by topic author enthusiast4

@enthusiast4 wrote:

how can I give offset value to the 'i' term of the FOR Loop. It doesn't allow. Can you please show me how?


 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 17
(3,665 Views)

Thank you. Can you tell me how I can control the slider such that it starts from 201 and stops at 500 i.e  when frame numbers: 201-500  are displayed on the Image Display simultaneously the slider displays those particular frame numbers. I am not able to relate the both. Somehow the slider displays it starting from 0-299, instead of 201-500.

0 Kudos
Message 5 of 17
(3,652 Views)

Use a property node to set the Data Entry Limits->Maximum and Minimum.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 17
(3,640 Views)

Hello All!

I am trying to display the frame numbers of an AVI file by using a horizontal slider. I have programmed such that the AVI file runs only  for the frames 201-500. Next, I want to display those frame numbers on a horizontal slider  such that the slider starts from 201 and ends at 500.

But, the slider displays it starting from 0-299, instead of 201-500.

Can someone suggest me what I am doing wrong as I have spent hours trying to find a solution but I am stuck somewhere.

PS: Below is the attached Code. Check only the state 2

0 Kudos
Message 7 of 17
(3,526 Views)

I have tried that too. The slider shows as 201-500 when I change the property node of the slider to min: 201 and max: 500. But, while run the VI the slider again starts from 0-299 instead of 201-500.

0 Kudos
Message 8 of 17
(3,630 Views)

Assuming the slider is an indicator, make sure it is wired to the output of the addition, not the iteration terminal. And make sure the slider terminal is inside the loop.

 

(Sorry, posting by phone, cannot look at your code)

 

If the limits are always the same, you don't need property nodes.

0 Kudos
Message 9 of 17
(3,604 Views)

 


@altenbach wrote:

Assuming the slider is an indicator, make sure it is wired to the output of the addition, not the iteration terminal. And make sure the slider terminal is inside the loop.

 

(Sorry, posting by phone, cannot look at your code)

 

If the limits are always the same, you don't need property nodes.


 Thanks a lot. I will look into it again once I am back on Monday. Not a problem. Thanks again

0 Kudos
Message 10 of 17
(3,578 Views)