Reading encoder from Simulink

4 ビュー (過去 30 日間)
hassan talat
hassan talat 2019 年 7 月 9 日
Hello,
I need to know is there a way to call session specific functions from simulink?
I need to take positional encoder reading into simulink. I added the session creation and channel creation commands in model call backs so that every time a session is automatically created and channels are defined. This was NI Daq session is created in the workspace. Now i want to invoke the following function from simulink and do post processing in simulink model:
s = daq.createSession('ni'); %% command defined in model call back
ch = addCounterInputChannel(s, 'Dev1', 0, 'Position'); %% command defined in model call back
pos= inputSingleScan(s);
Through this command i get encoder position in matlab command window. I am using NI USB DAQ 6343 with US Digital E4T optical encoder.
I have tried Matlab function block, however it cannot do that.
Regards

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by