06-26-2015 05:53 AM
Hi,
I want to call a python script within my labview VI to process some data stored in a large array (around 48000 elements) and pass another (much smaller) array back to labview. My aim is to call the script in a loop - constantly updating and processing the data - so ideally, the method of passing the data to the script would need to be fairly efficient.
I've seen the System Exec.vi example here http://www.ni.com/tutorial/8493/en/
Can I pass large arrays as input arguments? Is this an efficient way of doing it?
I've also seen some references in various forums to using sockets to pass data between python and labview. Any examples of how to do this?
Thanks, Mike
06-26-2015 06:01 AM
I posted an example using LabPython to solve a tough math problem just a little while ago. If you can use open source toolkits, LabPython is a possibility that'll let you avoid passing data out of LabVIEW to System Exec.
06-29-2015 08:50 AM
Thanks jcarmody. I had a go with your example and was able to get it to work with arrays as inputs but couldn't get it to work with python packages (e.g. numpy). I get a syntax error when I try and use the import command in the scipt file.
Also, I could only get it to work on python 2.5. All my code is written for python 2.7 and I'm nost sure about compatibility. Will labpython work with python 2.7?
Thanks, Mike
06-29-2015 09:33 AM
According to its creator, Rolf Kalbermatter, it should work with 2.7. The bad news is he has dropped the project so there have been no updates for over 10 years. See this post for more info: http://forums.ni.com/t5/LabVIEW/Trouble-with-LabPython-Setting-up-the-Python-Server/td-p/1444082