[英]NiDAQMX close all created tasks
I would like to close all the previously created tasks in the nidaqmx-python
module. 我想在
nidaqmx-python
模块中关闭所有以前创建的任务。
How can I do this? 我怎样才能做到这一点?
In example, I have a number of previously opened tasks: 在示例中,我有许多以前打开的任务:
for i in range(10):
nidaqmx.Task()
which I did not close. 我没有关闭。 However, I want to close them now.
但是,我想现在关闭它们。
According to the source, you'll have to do something like the following: 根据消息来源,你必须做以下事情:
tasks = []
for i in range(10):
tasks.append(nidaqmx.Task())
# Some code ...
for task in tasks:
task.close()
See https://github.com/ni/nidaqmx-python/blob/master/nidaqmx/task.py#L448 请参阅https://github.com/ni/nidaqmx-python/blob/master/nidaqmx/task.py#L448
Have you tried using a reset_device() on the device you are using? 您是否尝试在正在使用的设备上使用reset_device() ? It should make all tasks associated with the device able to be started again.
它应该能够再次启动与设备关联的所有任务。
edit: though it cleared the tasks, but it only aborts them. 编辑:虽然它清除了任务,但它只是中止它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.