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?

조회 수: 1 (최근 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?

답변 (1개)

Vidip
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:

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by