05-05-2009 10:28 AM
¿Cómo puedo reinicializar un array ( eliminar todos sus elementos ) cuando pulso un botón que tengo asociado a una estructura de evento?. Todavía uso Labview 7.10.
Gracias
Solved! Go to Solution.
05-05-2009 10:53 AM
Hi Harlock,
Thanks for your post and I hope your well today.
You can 'reset' an array using the 'Replace Array Subset' function in the array palette. I then for-looped this function to replace the elements one-by-one to zero. I couldnt think
quickly of a better solution than this - maybe someone else has one?
Here is some code to show it working. (LV 7.1)
I hope it finds you well,
05-07-2009 07:12 AM
Thank you Hillman for your reply.
I'm virtually a novice in Labview ( in english too, sorry ) and is difficult to me to understand a not sequential code. Then here I give to you "resetarray2.vi" attachment that is a simple example of a bigger program I'm developing. In this I need to reset the array to zero elements, not only erase each element, and the action may be triggered in the "Set to 0:Value change" case in the Event structure.
Thanks a lot.
(Note: is the first reply I wrote in this faq, if there is any problem with the text or the attachment please say to me)
05-07-2009 08:25 AM
Hi Harlock,
Thanks for the reply and I hope your well today.
Your English was fine - I fully understand what you meant.
Please see attached code.
I would like to mention, that its generally good practice not to build arrays like we are doing in this example. If at all possible you can avoid building arrays during the execution then I would advise - this is because LabVIEW can allocate memory for arrays with a known size. If the array was going to be very large, then you could have a memory crash with LabVIEW. So as long as you keep the array your building fairly small - then you should be ok.
Please let me know how the code finds you,
05-14-2009 01:33 AM
Hi Hillman,
At last here you have my "final" code. Now I need to apply it in my program.
I'll work to understand the Labview code structure and the use of arrays, luckily I'm going to be at a NI practical session next June.
Thank you a lot.
Harlock