05-19-2009 12:47 PM
PhilipJoeP wrote:
Dennis, Yes, this post you provided me looks very familiar.However, what I was talking about in that post is completely different from what I'm discussing in this post. In that post, I wanted to auto generate a cluster of various data types. In this post, I want to go from the .txt file of SAME TYPE data to a cluster of this data. Reason is, we've run into major problems passing LabView arrays into a DLL created using Simulink. NI is working with us to figure out why. Within the Simulink model (DLL) we are using a bus object (similar to a cluster) with an array inside of it. When testing the model in Simulink, all works fine. It's when we wire an array in a cluster (in LabView) to the array in DLL that we have problems. One of our work-around is, replace the array in our cluster with a cluster of same data type numeric controls. (Resulting with a cluster within a cluster… the inner cluster basically replacing our array) When we map the inner cluster of elements to the array in the DLL, all works fine. So it's a LabView array problem and probably how it's allocated in memory. Sooo... now I’m interested in trying to automate the creation of a cluster of same data type elements. In the example VI I attached to this post, I convert a .txt file, to an array, to a cluster. I can run the VI (which populates the cluster) and then i can change the resulting cluster to a control, type def it, and then use it again elsewhere. However, it looks as if my solution attached will only create a cluster of at most 256 elements (based on the limitation in the "array to cluster" function). I need to figure out a way to take, for example, a .txt file of 300 or more same data type elements and (using the procedure I outlined above) create a type def cluster control that I can use in other VIs. I am not trying to create the cluster dynamically during run time. And of course, the VI I used above would not be in any of my application VIs. It's simply used as a work around. Hopefully i am being clear.
What you are asking can be done using scripting. I have done exactly that.
If NI is helping you with this issue then tell them exactly waht you are attempting and ask them to write a VI that creates the cluster. Tell them you don't need to see how they are doing it, you just need that fuctionality.
If you are ambitious check the Scripting Forum and the Code repository on LAVA. I believe Ton has written that code.
Have fun!
Ben
05-19-2009 12:50 PM
PhilipJoeP wrote:
In this post, I want to go from the .txt file of SAME TYPE data to a cluster of this data.
I need to figure out a way to take, for example, a .txt file of 300 or more same data type elements
It does not matter if they're the same or not. The situation is the same as what was discussed in the previous post.
05-19-2009 12:55 PM
05-20-2009 05:14 PM
Ben,
Do you have any example VI's or scripts? I've tried searching the scripting forum, but I never know what I am looking for (since scripting is something i have never done). Are there any forum posts I should look at specifically?
Thanks
05-20-2009 05:21 PM
Dennis Knutson wrote:
The only thing I can think of offhand is to use a different programming language and create a wrapper that accepts a LabVIEW array and dynamically creates a container that you would pass to this other dll.
Dennis,
Thanks for the response. However, the whole purpose of me creating the cluster is to that I can save it as a type def. The method you explained above requires me to do this at runtime for each isntance of that data cluster type. It's unfortunate that NI didn't think the array to cluster converter through enough that it would accept a larger size array. I need to do some research on how big a cluster can be, or figure out what it's limitations are.
Thanks for the help.
05-20-2009 05:37 PM
PhilipJoeP wrote:It's unfortunate that NI didn't think the array to cluster converter through enough that it would accept a larger size array.
You can wire in an array as big as you want. You're still only going to get out a maximum of 256.
05-20-2009 05:51 PM
smercurio_fc wrote:
PhilipJoeP wrote:It's unfortunate that NI didn't think the array to cluster converter through enough that it would accept a larger size array.
You can wire in an array as big as you want. You're still only going to get out a maximum of 256.
This I'm aware of. Am I wrong to comment on the limitation of 256 elements for the convert array to cluster fucntion?
05-20-2009 06:28 PM
05-20-2009 09:48 PM
You would need scripting in order to programatically create a cluster, you would need scripting to programatically create a type def. You have a limitation with the Array to Cluster. And in another post, you've been told you cannot use a simple type cast. It sounds like you should reevaluate your decision not to use the simulation toolkit. The amount of time you've already spent on this subject has probably exceeded the cost of the toolkit. I know I've wasted too much time.
And in regards to scripting, I had a recent converstation with one of the NI scripting gurus. He was of the opinion that scripting will never be officially supported. He also stated that it is somewhat fragile and that every release of LabVIEW has required extensive modifications to existing scripts.
Your choice - the toolkit, scripting, or wrapper dlls.
05-21-2009 06:10 AM
PhilipJoeP wrote:Ben,
Do you have any example VI's or scripts? I've tried searching the scripting forum, but I never know what I am looking for (since scripting is something i have never done). Are there any forum posts I should look at specifically?
Thanks
No they all seemed to have been lost in a hard drive crash from some years ago.
LAVAG.org has a scripting forum.
Ben