首页 > 代码库 > Labview调用Python脚本

Labview调用Python脚本

Labview程序框图如下:

技术分享

Python脚本如下:

#!/usr/bin/env python
import sys

#Command Line Arguements are stored in list argv
numArgs = len(sys.argv) - 1
sum = 0

#Iterate through each element and add to the sum
for n in range (1, len(sys.argv)):
  sum = sum + int(sys.argv[n])

sum = int(sys.argv[1]) - int(sys.argv[2])

#use the print function to output the sum
print sum

脚本.py文件在这种情况下需要放在当前VI的文件目录下。

Labview调用Python脚本