LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster Coercion

Hi all,

 

My example vi converts a 50 elements cluster to an erray, modifies an element in the array, converts the array back to a cluster, and update the original array through an local variable.  I am getting a coercion dot on my local variable.  Can anyone explain to me why is that?  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 6
(3,116 Views)

If you hover the wire after the 'Array to Cluster' node you will see in the context display that the elements are named 'Alarm_CMD Parameters[x]'

Since your local has different names  there is a conversion, this should however not cost any CPU cycles.

 

But I doubt that this is the most versatile and flexible way to manage this.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 6
(3,113 Views)
It's because the control is connected to a typedef, and once you convert it to an array that type information is lost. There's no coercion dot if you disconnect the control from its typedef. It's probably not worth losing the typedef connection just to fix the coercion dot.
 
A tip to help figure type errors out is to open the context help (ctrl h), and hold the mouse over the various wires, then you can see the type that labview is using for that wire.
 
Matt
Message Edited by Matt W on 02-08-2010 03:05 PM
0 Kudos
Message 3 of 6
(3,105 Views)
Is there a better way to do this then, without getting ride of the typ-def? 
------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 4 of 6
(3,092 Views)

You might be able to restructure your code so you don't need the dot. Also In general you should avoid local variables, but you may have a valid use here. I can't make suggestions without more info about what you're trying to do. You could also ignore the dot, since it's just a warning (maybe put a label next to it to remind yourself that you checked that it's fine).

 

Two other options I wouldn't recommend are using a typecast to do explicitly what the type cast is doing implicitly (but this can also hide legimate type errors since type cast is very liberal about what it converts around). Variant to Data would also work but that adds a run time cost but at least it spits out an error at run time if you do something really off.

Message Edited by Matt W on 02-08-2010 03:40 PM
0 Kudos
Message 5 of 6
(3,074 Views)
Thanks!
------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 6 of 6
(3,066 Views)