LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I reinitialize an array to default (empty) other than invoke nodes?

Solved!
Go to solution

I have used the reinitialize all to default invoke node and the specific invoke node to reinitialize two arrays in my subVI every time the subVI is run in my program (main VI). I am using the subVI to take measurements, but the measurements I am taking continually stack upon each other. I already have these arrays wired as outputs so I do not think I can input an empty array, and the invoke nodes are activated (and return no error codes!) each time the subVI is run, but these two arrays are not reinitialized to their default, empty values at the beginning of each pass! All ideas are welcome; I appreciate your help. Thank you!

0 Kudos
Message 1 of 5
(5,781 Views)
You may have set the default value to something other than an empty array. Instead, you can write an empty array to a local variable of the array.
0 Kudos
Message 2 of 5
(5,779 Views)

@JosephQ wrote:

I have used the reinitialize all to default invoke node and the specific invoke node to reinitialize two arrays in my subVI every time the subVI is run in my program (main VI). I am using the subVI to take measurements, but the measurements I am taking continually stack upon each other. I already have these arrays wired as outputs so I do not think I can input an empty array, and the invoke nodes are activated (and return no error codes!) each time the subVI is run, but these two arrays are not reinitialized to their default, empty values at the beginning of each pass! All ideas are welcome; I appreciate your help. Thank you!


That sounds like you have an unwanted uninitialized shift register.  If you attach the sub-vi we can help you more


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 5
(5,767 Views)

Show your code.  Are you dealing with uninitialized shift registers?  If you want to return a value to an empty array, whether it is the value of a control or indicator, or the input into a shift register, you can wire an empty array constant to it.

0 Kudos
Message 4 of 5
(5,764 Views)
Solution
Accepted by topic author JosephQ

I actually managed to almost get what I wanted by replacing the feedback nodes I was using (to build the two arrays) with shift registers, then initializing the shift registers at the start of the program. The problem there was that the encoder I was using for angle measurement would start back up where it left off (at 400 degrees rather than 0, even though it was a new data set). However, it deleted the previous data set, which is what I wanted. I think I may be able to work with that; I just need to use the last known measurement as an offset or something so the first measurement can be 0... Suggestions are still welcome; Thank you all for your time!

 

Edit: For simplicity's sake I just moved the property nodes' initializers out to the furthest loop and it is doing the same thing.

0 Kudos
Message 5 of 5
(5,746 Views)