LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to empty array dynamically

I am trying to build a array to store the x cursor position data. Each time, I can drage X cursor and move left or right. Then I click "add data in array", the x position is added to array. I can continue to add as many as I want when I move x cursor again and again. All those work good. I want to keep loop and sequence structure as attached VI.
My problem is: I have difficulty to empty array dynamically. For example, I did not choose right x cursor position, I want clean/empty array just by click "CLEAN" button. I do not want event structure to do this since it cause other problems.
Please take a look see how to make it.
Thanks
 
0 Kudos
Message 1 of 7
(3,777 Views)
You need to feed an empty array to the shift register, not to the indicator. 😉
 
See attached, LabVIEW 8.0.
 
(You don't even need an empty array constant, just use "use default if unwired" on the output tunnel. The default data for an array is an empty array.).
 
Also, your outer loop is pointless. It does not do anything since it stops at the same time as the inner loop. You only need the inner loop. ... and why do you need a big sequence structure??? 😮

Message Edited by altenbach on 04-11-2006 09:21 AM

Message 2 of 7
(3,774 Views)
(I have edited the attachment above and attached a new example. I added an event to display the cursor location as it gets moved. In case you got the first version, please download buildArraycleanMOD2.vi again.)
0 Kudos
Message 3 of 7
(3,760 Views)
I have a big program. I remove a lot of staff just for making my question clear. and of course it looks stupid. But I want keep my structure. I can not use event structure for this problem. Can you make it without event structure? thank you very much.
0 Kudos
Message 4 of 7
(3,758 Views)
I am very sure that you could use an event structure in your big program, and it would probably improve your code. Trust me! 😉
 
Anyway, here's a 10 second modification of your original VI that clears the shift register. It's the same idea as above!
0 Kudos
Message 5 of 7
(3,751 Views)
I tried helping detech with his event structure in a previous thread.  I must have done a really poor job, for some reason the event structure was slowing his program down.  Robot Sad
0 Kudos
Message 6 of 7
(3,748 Views)

You all did great job for me. But as I said, there is misunderstanding with my problem since  I can not post huge VI and I have to simplyfy my question. For the simplfied question, there seems a lot approchs to the solution. However, I need to think how to combine your solution to my big VI.

Like yesterday, you helped me a lot. But when I combined it to big VI, I generate other problems. So today I post new question and try to avoid event structure for my problem.

Thank you all for help. I am really learning alot from your discussion. Your replies are all 5 starts.

0 Kudos
Message 7 of 7
(3,739 Views)