05-18-2009 06:33 PM
I am trying to use the following VI to convert the provided .txt file into a cluster indicator of numeric values. So far, the VI works perfectly. However, I would like the cluster to resize to the number of elements it contains based off the number of integers in the .txt file.
Therefore, if have a .txt file of 5 integer elements, I want the VI to produce a cluster indicator of exactly 5 numeric indicators (as well as to resize the cluster borders to fit these numeric indicators). If I then load a different .txt file of only 3 integer elements and run the VI, I would like the cluster indicator to then only have 3 elements and resize.
Of course, I want this functionality without having to close or re-code the VI. Apparently, I can’t initialize the number of elements within a cluster to default value. Brute force is always a solution. However, my application may contain hundreds of elements, hence why I would want this to be done automatically.
I don’t think there is a property node or invoke node solution to this (or at least I can’t find it). Is there any way to use a state machine that in the first state deletes any previous cluster and in the next state populates it?
Any help would be much appreciated!
Thanks.
Solved! Go to Solution.
05-18-2009 09:24 PM
05-18-2009 09:53 PM
hi
i am not sure it is correct but I am thinking at the array_to_cluster conversion. an array can be automatically created (just read all the stuff in a while loop then index the output) then you can convert it to a cluster ?
regards
05-18-2009 10:54 PM
05-19-2009 02:33 AM
05-19-2009 02:41 AM - edited 05-19-2009 02:44 AM
It sounds like you're only loading Integers from the text file, no?
If so, add them to an integer array (or double for more general behaviour) and it'll be general.
If there's some administrative reason for the cluster then you can add an array inside the cluster to make it dynamic, the cluster itself wont be, however.
And/or you can ofcourse make an array of the cluster ...
/Y
05-19-2009 10:04 AM
Basically, I’m trying to go from a .txt or CSV file with a list of integers (doubles, etc…) and want a cluster indicator to be created containing each element in the list as its own numeric indicator. All the numbers in the list would be the same data type. I cannot use an array or an array within the cluster for my application. I also cannot use an array of clusters.
I have to feed data to a .dll file, and for some reason arrays do not work correctly in a cluster for this application. The number of elements in the list could easily break 256, the limit for the array to cluster function. I’m not sure what the element/size limit is for a cluster.
05-19-2009 10:12 AM
PhilipJoeP wrote:
I have to feed data to a .dll file, and for some reason arrays do not work correctly in a cluster for this application. The number of elements in the list could easily break 256, the limit for the array to cluster function. I’m not sure what the element/size limit is for a cluster.
Well, this changes the equation quite a bit now, doesn't it. I don't think dynamically creating clusters is really your solution. Perhaps you can provide some more information about this DLL. Passing arrays to DLLs has been done for quite some time now. Have you looked at the example that ships with LabVIEW called (appropriately) "Call DLL"? It shows how to pass lots of different datatypes.
05-19-2009 10:18 AM
05-19-2009 12:37 PM