From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Outputs from Python Node

Solved!
Go to solution

Hi, 

 

Is it possible to have more than one output from the Python Node in LabVIEW? There is only one "Return Value" terminal and then the rest are "Output Parameter" terminals which are just for returning the amended value of the corresponding input parameter as I understand it. Could I return an array from Python and then split this array to be displayed on individual indicators in LabVIEW? How exactly would I go about doing this? 

 

Thanks in advance!

0 Kudos
Message 1 of 6
(7,790 Views)
Solution
Accepted by topic author zhale

You can return a list of the same data type from Python as an array in LabVIEW. Does that satisfy your requirements?

 

Here's an example (modified from my previous example in another post):

modPythonSnippet.pngpythonScript.png


GCentral
Message 2 of 6
(7,774 Views)

cbutcher, 

 

Yes thanks this is perfect! What's the easiest way to split the values of the 1D array back into the individual components of the array? 

0 Kudos
Message 3 of 6
(7,766 Views)

In LabVIEW? Index Array 🙂


GCentral
Message 4 of 6
(7,764 Views)

Hello, did you install the numpy in your Python? In my case, even i didn't import numpy, just install it in Python, an array cannot be returned from the Python node.

0 Kudos
Message 5 of 6
(7,406 Views)

In the examples here, I was returning a Python List, not an array. I haven't tried with Numpy arrays, but there is a message here (from the makers of the Python toolkit, which has been somewhat replaced) suggesting a workaround.


GCentral
0 Kudos
Message 6 of 6
(7,397 Views)