LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prevent overwriting of variable during second loop...

Hello together, I have an issue with getting the first
value of a variable -
I want to store the value of an output variable in the first
sequence of my for loop.
How can I prevent that the variable is not being overwritten
during the next loops.
Would appreciate some hints thanks...
0 Kudos
Message 1 of 8
(3,977 Views)
Hi Steffan,

You have a function just for that:

Functions palette
-> Advanced
-> Synchronization
-> First call? function

The output is a boolean that's true the first time it is executed. You can place a case for initialization purpouses if true, and false for the rest

Hope it helps,
Aitortxo.
0 Kudos
Message 2 of 8
(3,967 Views)
Here is a simple way to update a varible inside a loop, only on first iteration
 
hope this helps
0 Kudos
Message 3 of 8
(3,963 Views)

The first call does what it says : true on the first call, false on the rest of the time. Can't be used if your loop is called several times.

You could simply use a case structure, connected to the loop index and detecting the i = 0 case, as in the attached example.

Chilly Charly    (aka CC)
Message 4 of 8
(3,962 Views)
Sorry, but I think I don't understand the procedure with the case or I have
a prob with my output - all I wanna do is save my first output value
during the first iteration = 0 -
see attached my case structure - in case of i=1 it is empty - but there
is an error message with "missing tunnel" ?
 
 
0 Kudos
Message 5 of 8
(3,949 Views)
Stefan,

You get an error "tunnel missing" because you have to output a value for each possible case. In your image, there is a value linked for case "0" but you also have to link values for all the other cases.
In CC's example the value enters in the case, do you undersand the difference ?

hope this help you.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 8
(3,946 Views)
Perhaps it's too late now, but I didn't get it anyway -
in cc's case, the case selection has the same structure as
I have, only the orange recangle isn't filled out - perhaps that's the
prob - but I still get the tunnel message.
I don't know what's wrong - see my two cases attached....
Download All
0 Kudos
Message 7 of 8
(3,940 Views)

Stefan,

use your intuition, and try to figure out what your diagram is doing : the CistMin2 output is wired to the case condition, but there is no input, nothing wired to it !

In my example, as already explained by TiTou, the output variable was inside the case condition, so there was no problem with case values other than zero.

Message Edité par chilly charly le 03-27-2006 05:07 PM

Chilly Charly    (aka CC)
Message 8 of 8
(3,930 Views)