LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reinicializar array con boton

Solved!
Go to solution

¿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

0 Kudos
Message 1 of 5
(2,626 Views)

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, 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
0 Kudos
Message 2 of 5
(2,622 Views)

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)

0 Kudos
Message 3 of 5
(2,595 Views)

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,

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 5
(2,590 Views)
Solution
Accepted by topic author Harlock

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

0 Kudos
Message 5 of 5
(2,561 Views)