Why is the session interface no longer recommended? I have code that uses it and works, but can be slow. Will changing to the Data Acquisition interface speed up my code?
2 次查看(过去 30 天)
显示 更早的评论
Here is the part of my code that can be really slow:
valve1 = addDigitalChannel(session,'Dev1','port0/line0','OutputOnly');
valve2 = addDigitalChannel(session,'Dev1','port0/line1','OutputOnly');
valve3 = addDigitalChannel(session,'Dev1','port0/line2','OutputOnly');
valve4 = addDigitalChannel(session,'Dev1','port0/line3','OutputOnly');
trig1 = addDigitalChannel(session,'Dev1','port0/line6','OutputOnly');
trgi2 = addDigitalChannel(session,'Dev1','port0/line9','OutputOnly');
trig3 = addDigitalChannel(session,'Dev1','port0/line8','OutputOnly');
valve5 = addDigitalChannel(session,'Dev1','port0/line5','OutputOnly');
valve6 = addDigitalChannel(session,'Dev1','port0/line4','OutputOnly');
trig4 = addDigitalChannel(session,'Dev1','port0/line7','OutputOnly');
trig5 = addDigitalChannel(session,'Dev1','port0/line11','OutputOnly');
trig6 = addDigitalChannel(session,'Dev1','port0/line10','OutputOnly');
queueOutputData(session,actuators);
Everything works fine and is triggered on time, but it can be annoying to wait 30 seconds to initialize everything. Will swtiching over to the data acquisition interface be faster?
0 个评论
回答(1 个)
Vidip
2024-3-28
Your current code using the session interface might work, it's generally recommended to migrate to the Data Acquisition Toolbox for several reasons. The toolbox offers better performance, more features, and future-proofs your code against potential compatibility issues in future MATLAB releases.
To get more information regarding advantages and capabilities of the new interface, you can refer to the below release note link:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!