LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to delete the whole array programmatically

Hello,
 
Is it possible to destroy/kill an array programmatically (not delete subset)?  If yes, please tell me how.  THanks in advance.
 
Sugento
0 Kudos
Message 1 of 7
(11,400 Views)

Hi,

If you mean to empty an array, just create a property node/local vatiable of an array and pass an empty array into it

Regards

Dev

 

Message 2 of 7
(11,398 Views)
Hi Devchander,
 
Thank you for your reply.  I'm really surprised.  Are you always working? Smiley Happy  By emptying an array, it means LabVIEW still has that particular array in memory, doesn't it? what if I want to completely destroy the array to prevent memory issue?
 
I have a PXI-6515, an industrial 24V DIO card, that I used to monitor optical sensors.  I just found out after I hooked it up that the output from DAQmx for DIO is a 1-D boolean array.  I like to be able to plot the digital signals on the Digital Waveform Graph, and to do that I have to use shift register and concactenate the previous array with the newly read digital signal.  I only want to keep the array when a certain criteria is met.  When it's no longer met, I want to "destroy" the array.  Attach is a sample VI.  Is this an efficient way to plot a Digital signal?  also, since i'm using 24V, i can't use the TTL counter.  Is there a VI readily available to count signal highs and lows? I have made a VI that specifically does this but I'm just wondering if there is LabVIEW function that does it.  Thanks.
 
Peter
 
 
0 Kudos
Message 3 of 7
(11,394 Views)

Well Peter,

To be frank, it is the peak working hour (11:30 am to be precise!) in the part of the world i stay. Smiley Wink

Yes, your observation is correct.

i have two suggestions.

see if this link helps you https://www.ni.com/docs/en-US/bundle/labview/page/vi-memory-usage.html

Plus is it possible to make this part of your VI a sub vi?,now,you can clear the array, close it and open it each time you want to 'kill' this array and/or use "Request Deallocation" from Functions palette-> Advanced-> data manipulation palette ??

do others have suggestions on this?

For the last part of your query, I have not come across a labview function that counts high and lows of a digital signal, so i am not sure, Sorry.

Regards

Dev

 

 

 
Message 4 of 7
(11,392 Views)
See attached vi.  First, there is no need to find the array length to feed to N of the for loop, and there is no need to use index array.  If you right click on the entry point of the array going into the for loop and select "enable indexing", you will see the solid box turn to a box within a box.  This signifies that when the loop is run, each element from the array will be indexed and passed into the loop.  On the first iteration, element 0 will be passed into the loop, on second iteration, element 1 will be used, etc., until the last element has been processed, then the loop exits.
To count the number of highs, use the included code with the shift register as shown.
- tbob

Inventor of the WORM Global
Message 5 of 7
(11,363 Views)

Hi Devchander,

Thanks again for your reply and link.  I just got the chance to say thank you for your reply and link today. Work has been really crazy lately.  After reading the link and per your suggestion, here's what I'd do:  make the VI as a subVI, declare/initialize an array outside the loop, and when I'm done with the array I would replace the elements of the array with False (as if I initialize the array), and connect that to a shift register.  That way, only one array is created and it is used over and over again in the loop.  Thanks again.

0 Kudos
Message 6 of 7
(11,319 Views)
Hi tbob,
 
Thank you also for your reply and point the inefficiency in my code.  I am learning something new today.. Smiley Happy
0 Kudos
Message 7 of 7
(11,318 Views)