MATLAB Answers

Reading encoder from Simulink

4 views (last 30 days)
hassan talat
hassan talat on 9 Jul 2019
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 Comments

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by