11-09-2005 01:04 AM
11-09-2005 08:09 AM
Hi Siddhu,
Could you please post some sample code or an image?
How you organize your data really depends on the relationship of the various data entities and what you plan to do with it.
I would like to be of more help but your question was sufficiently abstract to leave me wondering what I can do to help!
Ben
11-09-2005 11:20 PM
Hi Ben!
Sorry for making the question so abstart. Generalizing my question with an example.
My question with reference to the vi I have attched is does each element in the main array( Here it is main cluster) occupy same amount of memory irrespecive of the no of elements in the arrays present in cluster 1 and cluster 2.
Siddhu
11-10-2005 12:36 PM
11-10-2005
05:46 PM
- last edited on
10-22-2025
04:55 PM
by
Content Cleaner
Yikes!
If there was ever a time I could use Greg McKaskle's help it would be now.
I will do my best, so here goes.
App note 154 found here
http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/370dfc6fd19b318c86256a33006bfb78
says,
"
Arrays
LabVIEW stores arrays as handles, or pointers to pointers, that contain the size of each dimension of the array in 32-bit integers followed by the data.
"
and goes on to say
"Clusters
LabVIEW stores cluster elements of varying data types according to the cluster order. .... LabVIEW stores scalar data directly in the cluster. LabVIEW stores arrays, strings, and paths indirectly. The LabVIEW cluster stores a handle that points to the location in memory where the data is stored.
"
So after reading that (doesn't app note 154 just thrill you?
) and looking at you example I would be tempted to say that because you are asking about an
array of
clusters of
clusters of
arrays
then all we have is a bunch of pointers to data that is elsewhere and I would have to agree with vivi's posting.
But that is only talking about how the data is organized in memory and does take into concideration what LV is doing with that data and also draws a very fine line between THE CLUSTER adn the DATA IN THE CLUSTER.
In C you have to keep that stuff in mind. In LV, the data in memory is kinda worthless unless you "touch" it in some way.
To illustrate that clusters and arrys are the the handles+data I put together the following code.
As shown buffers are allocated in the initial frame and re-used the rest of the example.
I have configured the two controls "Main Array" and "Main Array2" such that the both contain a single element.
The single element in "Main Array" only has a single element in the array of the first of its sub-clusters.
The single element in "Main Array2" has 10,000 values in the array in the first sub-cluster.
So since I am doing everything "in-place" (not creating new buffers) and if copying an array element is simply a matter of copying a handle over-top of itself, THEN it should take the same amount of time to replace element 0 with element 0 for both "Main Array" and "Main Array2".
Running the VI shows that this is NOT true. The small array 50ms and the large about 9 seconds.
So...
While I am developing in LV I do not think about how the data structure is stored but more about how much memory is required to store the data in the wire, and try to minimize how many times that data is duplicated.
Message Edited by Ben on 11-10-2005 05:47 PM