LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems resetting an array

Solved!
Go to solution

Hello,

 

I have a case structure in a subVI which is enabled from some external event, and when enabled it must “remember” the current value of a constant stream of measured data during the first iteration of the case structure. After the first iteration the “remembered” value must be used as a reference which is subtracted from the following values of the measured data, creating an error which is used in the control.  The problem is that when the case structure is disabled for a moment and then enabled again, the array I use “remember” the value from the first time it was enabled. I know it is possible to reset the array with a Boolean control, but it is important that the array is reset automatically during the first iteration of the case structure.

I hope someone can help me.

 

 Thanks in advance.

 

Jeppe

Udklip.JPG

 

 

 

 

0 Kudos
Message 1 of 13
(4,023 Views)

A lot of your description and code is not very clear.

 

Why do you built an ever-growing array in a feedback node if all you need is a single element?

What is in the other case of the case structure?

 

It would really make things much easier for us if you could attach the actual VI instead of an image!

What is your LabVIEW version?

 

Something like in the image would work for a switch action boolean.

 

Using a latch action boolean would make things even easier, see attached VI.

 

Modify as needed. 😉 

Download All
0 Kudos
Message 2 of 13
(4,004 Views)

I am sorry for the confusion. I just thought I shuold spare you for all the details. But you are right, it is not important to me to save all the element in an array. The thing I need - no matter the code - is to save one value from a constant stream of measured data through a case structure, which is in a subVI which again is in a While-loop. The measured data goes from the While-loop to the subVI, in which one value of the measured data is saved as soon as the measured data exceeds a specific (variable) value - therefore the case structure. When this happens the saved value must the be subtracted from the still ongoing stream creating the error as described earlier. Until the measured data exceeds the specific value the stream of data must just go through to the error-indicator without any saved data.

 

I hope this helps understanding my problem.

0 Kudos
Message 3 of 13
(3,996 Views)
 

I forgot to mension that the saved value from the stream of data must be reset either when the case structure goes from enabled to disabled state or during the first iteration of the enabled case structure, before a new value saved from the stream of data.

0 Kudos
Message 4 of 13
(3,994 Views)

Use a logical OR of: [i]=0 or "boolean" 

 

You still have not attached your VI.

Message Edited by altenbach on 05-22-2010 09:50 AM
0 Kudos
Message 5 of 13
(3,971 Views)

I'd connect that array to the loops borders as a shift register and then you can simply add or reset in the case structure. (if i understand the problem correctly)



/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 13
(3,959 Views)

I am not sure I understand your suggestions, but I have attached the VI so you can try it yourself.

 

Again, I hope this helps Smiley Happy

0 Kudos
Message 7 of 13
(3,953 Views)
Solution
Accepted by topic author Jeppe Mortensen

Jeppe Mortensen wrote:
I forgot to mension that the saved value from the stream of data must be reset either when the case structure goes from enabled to disabled state or during the first iteration of the enabled case structure, before a new value saved from the stream of data.

 

What happens to the value stored in the feedback node during enabled-disabled transition is irrelevant, because it does not matter while the case is false and will get reset next time it turns true. Simply place the indicator after the case.
 
See attached. Modify as needed. Let me know if you have any questions.
 
 
Message Edited by altenbach on 05-22-2010 01:23 PM
Message 8 of 13
(3,941 Views)
Thaks a million. It helped a lot Smiley Very Happy
0 Kudos
Message 9 of 13
(3,905 Views)

Here's a even slightly simpler version. 😉

 

 

Message 10 of 13
(3,886 Views)