LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to keep just one copy of data in memory and be able to display it on the front panel using a control

I am creating a VI that has a 2D array of clusters on the front panel. The cluster contains multiple controls, one of them being a picture control. The array needs to be a control because the user needs to interact with the controls in the cluster.

 

I would like to be able to keep just one copy of this 2D array in memory but still be able to perform functions on the the data within the cluster such as changing the picture. I know how to avoid making copies of data while performing fucntions on the data by using shift registers with Replace Array Subset, In Place Element Structure, etc. I have also been able to keep just one copy of large data sets in memory when the data was not being displayed on the front panel via a control or indicator. I have never had to keep just one copy of the data in memory while still displaying it on the front panel and being able to still perform functions on it in the block diagram. Is this possible to do?

 

Something that I noticed. When I passed the 2D array of clusters into a loop via a shift register, performed function on the data within the loop without making copies, and then passed the data out of the loop via the shift register, and then put the data into a local variable of the 2D array via the output shift register, it seemed like only one buffer was being created for the data. When using the buffer allocation tool, the only buffer was on the original control, there were no buffers on the shift registers or the local variable. Is this corrrect? I thought that local variables will also cause a new buffer to be created.

 

Thanks for any help

 

 

0 Kudos
Message 1 of 5
(3,219 Views)

It seems that LabVIEW does not make another copy when you use a write local variable.

 

As far as i know LabVIEW uses two buffers of the data. One to contain the data that are displayed and one that contains the data. This is not bad.

How big are your data ?

How often they are updating ?

 

However i think you worry too much. If you did all those you wrote, you should not have any performance isuues. Have you ?

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

LabVIEW does have array functions that I believe will do what your seeking.  The VI's are called "in place" functions.  I don't have LabVIEW available at home at the moment so I can't give you more assistance than that right now.  If you search for the term "in place" in the functional pallet search you should find them.  To do this you will need to preallocate the array and use shift registers in a while loop.

 

 

I hope this helps.

 

Jason Willis

LabVIEW CLD 

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 3 of 5
(3,184 Views)

Jason Willis wrote:

LabVIEW does have array functions that I believe will do what your seeking.  The VI's are called "in place" functions. 


 

 You can do data handling "in place" without using the in place element structure. If the array size in the shift register does not change (and possibly other conditions are met) things are kept "in place", e.g. using "replace element". The compiler is very good at this. The "in place element structure" is only needed for the rare case where the compiler plays it too safe for some reason.

 

Still, the "in place element structure" is a very nice addition and often simplifies code constructs. 🙂

 

amaglio:

What is your LabVIEW version?

 

0 Kudos
Message 4 of 5
(3,172 Views)

No I have not had any performance issues yet, but I have not been using the application to the extent that it will be used yet. Its going to be possible to load hundreds of jpegs into the array so I just want to make sure from the beginning that the code is going to be as efficient as possible. Thanks for your help guys. I will stick with the one control of the data, and then just write it to a local variable when i need to update it. Thats cool, i never knew that when writing to local variables another buffer is not needed. I don't think the day would be complete without learning something new, especially when working with LabVIEW. Thanks again guys :smileyhappy:.

 

0 Kudos
Message 5 of 5
(3,149 Views)