LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"this wire connects to a polymorphic terminal that cannot accept this datatype"

Hi everybody,
Following is my problem with Type cast node
While connecting a cluster (consist of an array of integers + some other basic datatypes) to  type terminal of Type Cast node, It shows the wiring error ("This wire connects to a polymorphic terminal that cannot accept this datatype").

Basicaly i want to read a 'C' structure that consist of an array of int from a TCP/IP socket read node and than type cast it to a cluster in labview., but i am facing the above problem while trying to typecast it.

Thanks in advance on pondering to my question.
regards
Hamas
0 Kudos
Message 1 of 5
(5,409 Views)

Type Cast is a pretty low-level function that will only accept certain types.  Instead of using Type Cast, I'd recommend the Unflatten From String function.  This should take any type as the destination.  This is used commonly when saving data of a specific type, you can flatten it to string to write it and then unflatten it when reading it.  Using these functions with data from an external source may not be easy - you might need to break the structure down into simpler components to read it in to LabVIEW.

Good luck!

Message Edited by Jeff B on 04-09-2007 08:23 AM

0 Kudos
Message 2 of 5
(5,402 Views)
You cannot typecast data to a cluster type containing an array and other values, because there's no way for the typecast to know where the array ends and the rest of the data begins.  This restriction apparently holds even if the array is the last element in the cluster.  If the array data is at the end of the cluster, try this:  split your incoming array of ints at the point where you expect the fixed data to end and the array to start.  Typecast the fixed part of the array to your cluster, then bundle the remaining array into that cluster.  If the array data is in the middle of the cluster you'll have to do some more complicated work to determine the array length and extract it.
0 Kudos
Message 3 of 5
(5,387 Views)
Hi,

I'm pretty sure that your C array is of constant size. LabVIEW arrays are always of variable size. This is the reason the type casting here is not possible. However that doesn't mean you cannot do the typecasting. You just should use a cluster of multiple elements of the same type instead of an array of that type.

This particular issue was just quite extensively discussed at LAVA forum so I better not to replicate all the details but rather point you to the source of information.

Tomi Maila
--
Tomi Maila
0 Kudos
Message 4 of 5
(5,376 Views)
Thanks everyone for contributing...
I got my problem solved ....
thanks and regards
hamas
0 Kudos
Message 5 of 5
(5,257 Views)