05-27-2010 03:50 PM
Is this the best way to reference each element in a cluster? Please refer attachment
V
05-27-2010 04:12 PM
05-27-2010 04:20 PM
@brokenarrow,
Thank you so much for your reply. Will check them out. I am not sure what will happen if the order is changed. But, even if they do, I will make sure that the order doesn't change because I will know the values beforehand. I am learning this concept to create more subvi's that reference the front panel controls and indicators from the main VI.
V
05-27-2010 04:31 PM
Rather than using the Variant To Data you can typecast the cluster element to a more specific LabVIEW class (Numeric in your case).
Any particular reason why you're using DBLs for the Index Array? Also, do you know that you don't have to wire individual values into the index inputs, especially if you're peeling them off sequentially? Also, rather than using Index Array like that I would use an auto-indexed for-loop and place the reading of the value in the loop. That way it's there just once, and it's scalable. The way you have it, if you add a control to the cluster you have to modify the code.
Also, any particular reason why you're using the gargantuan connector pane?
05-28-2010 07:28 AM
Are you making this too complicated? What about a value property node and Unbundle by Name?
Lynn
05-28-2010 08:16 AM
05-28-2010 08:47 AM
johnsold wrote:Are you making this too complicated? What about a value property node and Unbundle by Name?
Lynn
If he's just trying to get to the values, then clearly your method is the best way. My take on reading the premise was that the OP wanted to eventually be able to do more than just get the value. Of course, that's just speculation on my part.
05-28-2010 08:48 AM
for(imstuck) wrote:
What about not using a refnum at all and just passing the cluster into the VI? Why is the reference there in the first place?
I think that when people post small examples utilizing references, they are speaking to a larger grand scheme, where the references are gotten inside a VI, and things can be manipulated wirelessly.
05-28-2010 08:55 AM
05-28-2010 09:18 AM - edited 05-28-2010 09:19 AM
Wow, U call it a day and have a good night sleep. Next day, your question has so many responses. Feels good to see my day start like that 🙂 Thanks Guys!
Now, let me answer each of your comments/questions.
@smercurio_fc
1. How do you typecast the cluster element to numeric class? I have exhausted options and came up with the one I did to reference each element.
2. Well, DBL's because these are calibration co-efficients and I want upto certain decimal places.
3. Point taken regarding indexing. I did not know that.
4. ___________________________________________________________________________________________
rather than using Index Array like that I would use an auto-indexed for-loop and place the reading of the value in the loop. That way it's there just once, and it's scalable. The way you have it, if you add a control to the cluster you have to modify the code
______________________________________________________________________________________________
I want these values in one shot. Isn't this simpler than using a for- loop? Or am I missing something here? And I don't get that you meant at the end reg. cluster control.
5. I had 5 outputs and I just chose the biggest connecter pane because my final program is way too big. 🙂
And you are spot on, on your guess. I will be doing way more than what this simple eg. suggests. This is just my way to clarify my understanding and get the concept right.
@ Lynn.
I am modularizing my code, so I am using references from main vi into the subvi for computation and then passing them back to main. What you said is good when I am reading them in the same vi. Also, how did you typecast the property node to Cluster 'strict'?
@for(imstuck)
I am learning to use References to modularize my code.
@broken arrow
Right on mate! 🙂
@Schubert
Thanks! I did look into that nugget and was overwhelmed.
Again thanks guys!
VeeJay