LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW cluster and python node

Hi,

I have a question!
I'm trying to send cluster data from LabVIEW to python through python node, but so far I have no clue how LabVIEW send cluster data to python (I mean in what format or form), have tried many python parsing options but still getting an error (end of topic), any ideas of how to parse cluster LabVIEW data in python!?

simple LabVIEW vi and python script would be really appreciated!

LabVIEW: (Hex 0x687) There was an error in executing the specified function. Python returned the following error: <class 'TypeError'> bad argument type for built-in operation

Message 1 of 10
(10,017 Views)

LabVIEW clusters can be sent to Python... but it looks like we forgot to include a shipping example for that. We will fix that mistake in the next version. In the meantime, here's the script to catch a cluster:

def SumClusterIntegers(cluster):
    "cluster[0] -> Integer, cluster[1] -> String, cluster[2] -> Integer"
    return cluster[0] + cluster[2]


And here's the VI:

Untitled.png

Untitled.png

Attached are the script and the VI. I hope that helps.

Download All
Message 2 of 10
(9,964 Views)

There is one shipping example that uses clusters, but it doesn't explicitly call out that it does. It is here:

examples\Connectivity\Python\PythonNode_ComputeEuclideanDistance.vi

We still should add an explicitly tagged example for this common operation.

Message 3 of 10
(9,956 Views)

it's really helpful thanks a lot!
but not quite what I meant, I want is the return value to be a cluster!

like in the picture I uploaded in cluster x2 (numeric3 would be 10 and string would be abc)

0 Kudos
Message 4 of 10
(9,942 Views)

Screen Shot 2018-10-04 at 18.40.37.png

0 Kudos
Message 5 of 10
(9,925 Views)

Hey ramymagdy,

 

Were you ever able to get this to work?  I am also working have a cluster output from the Python node, but running into the same error (1671) you show here.  I have a work around of calling separate functions for each, but this isn't as efficient as I'd like.  

 

Thanks,

RG

0 Kudos