LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

referencing an element from cluster

VeeJay,

 

"...how did you typecast the property node to Cluster 'strict'?  "  I did not.  I created the reference by context-clicking on the cluster terminal.  Then when I connected the reference to the property node, it adapted automatically.

 

If you make the cluster a type-def (good idea for other reasons as well), you could drop a copy of it in the subVI to get the data type for type casting.

 

Lynn 

0 Kudos
Message 11 of 42
(1,041 Views)

VeeJay wrote:

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.


Use the To More Specific Class function:

 

 

 


2. Well, DBL's because these are calibration co-efficients and I want upto certain decimal places.

I don't undertand what this means. Do you mean that you need a fractional index? If so, then you need to use Threshold 1D Array followed by the Interpolate 1D Array or you can use the Interpolate 1D VI in the Mathematics palette. The datatype of the index values have no bearing on the actual data of the elements.

 


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.

 


 

 The point of using a for-loop is so that you don't have duplicate code. Look at the code you originally had. Now look at this:

 

 

 

Which do you think is more scalable? Smiley Wink

 


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.


Then perhaps you should be outputting an array rather than individual elements. Wiring to that gargantuan connector pane is close to impossible. In all of the VIs I have written in my time (which is literally thousands), I've used the standard 4-2-2-4 about 99% of the time. For the rest, I've used a more dense connector about 0.1% of the time. The rest has been smaller density to make small icons. 

 

 


@ 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'?


 

Lynn has already answered your question, so let me impart a tip on you for creating references for subVIs: On the higher level VI create the reference. Then, drag the reference terminal from the block diagram of the parent VI onto the front panel of the subVI. Done.

Message Edited by smercurio_fc on 05-28-2010 09:37 AM
Download All
Message 12 of 42
(1,029 Views)

@ Lynn

 

Thank you for your comments!

 

@ smerferio_fc

 

I think I will get the array and then index them in the subvi as opposed to referencing individual elements. Makes more sense. It is just that I started playing around with references yesterday and now that I get how to do it in LabVIEW, I guess I will be ok.

 

W.r.t DBL, these 5 coefficients will be read out of a calibration text file stored in a folder. All I want is to read the values without changing the numerical representation. I thought choosing DBL with say 3-4 digits for precision will not change 21.073 to 21.1. 

 

I agree, for loop seems more scalable. WHen you put them in words, it was hard for me to see why. Oh and I will try to make optimal use of connector panes. btw, neato on the trick to drag reference terminal from one vi to other.

 

Thanks!

 

VJ

I may not be perfect, but I'm all I got!
0 Kudos
Message 13 of 42
(1,007 Views)

Also, in two sided communication between main and subvi, would it be more efficient to create references for values that the main vi reads from subvi?

 

 

I may not be perfect, but I'm all I got!
0 Kudos
Message 14 of 42
(993 Views)

W.r.t DBL, these 5 coefficients will be read out of a calibration text file stored in a folder. All I want is to read the values without changing the numerical representation. I thought choosing DBL with say 3-4 digits for precision will not change 21.073 to 21.1. 

You're still not understanding. The index input of the Index Array function is an integer. It refers to which element you want to pull out. It's irrelevant what the datatype of the array is. This is fundamental programming knowledge. I don't quite get why you think the index input has to be a double. 

0 Kudos
Message 15 of 42
(989 Views)

Vee Jay:

 

Smercurio is talking about this:

 

Index.PNG

 

- tbob

Inventor of the WORM Global
Message 16 of 42
(971 Views)

Ohhhh! My bad... Yes smercurio_fc, I get it.... I don't know why I was changing those elements to DBL. Maybe I was not thinking at that moment. Also, your esoteric language didnot make it clear to me 😉 I was in mechanical mode probably...

 

@tbob Thanks! Simple as always! 🙂

 

Vj

I may not be perfect, but I'm all I got!
0 Kudos
Message 17 of 42
(957 Views)

I am not able to figure why this is happening. Values and waveforms from subvi are not getting updated on the main vi while the case is running. When the case is ends, that's when the values from subvi are seen on the main vi front panel. Why is this happening? The reason I am asking this is because it worked for sometime and then stopped working. (I was saving multiple copies and lost track which version of subvi I was using). Now, I am back to square one and main vi is able to send info to the subvi, but the feedback from subvi is not being updated in mainvi.

 

THanks!

 

V

I may not be perfect, but I'm all I got!
Download All
0 Kudos
Message 18 of 42
(902 Views)
You did not include the subVIs, so there's no way for us to tell what they're doing.
0 Kudos
Message 19 of 42
(889 Views)

Actually, instead of the big subvi part, I am attaching an example program. Here, I can see that both loops run parallelly (if that is a word) but updates are not continuous on the main vi while subvi's are running. Help!

 

V

Message Edited by VeeJay on 06-01-2010 04:46 PM
I may not be perfect, but I'm all I got!
Download All
0 Kudos
Message 20 of 42
(885 Views)