converting TriggerFcn in legacy to session based
1 view (last 30 days)
Show older comments
I was looking my older code with legacy data acquisition toolbox. I decide to convert, that code to session base and I simultaneously could change Matlab to new 64 bit version. I came across problem, that in legacy code I used TriggerFcn for detecting, when external trigger happened. I looked around session based help, but could not find the similar solution. The problem is, that the program simultaneously uses analog input, analog output and draws to the screen. All this is triggered by external trigger pulse.
0 Comments
Answers (1)
Jyotish Robin
on 10 Oct 2017
Hi Juoni!
Currently in DAQ Session, there is no equivalent functionality to StopFcn and TriggerFcn in DAQ Legacy in the session based interface.
As you may be knowing TriggerFcn specify callback function to execute when trigger occurs.
One possible approach to achieve a similar effect with Session is to use a MATLAB property event listener for a corresponding predefined session property. http://www.mathworks.com/help/matlab/ref/handle.addlistener.html
For a trigger event, create a listener for the 'IsWaitingForExternalTrigger' session property.
lh1 = s.addlistener('IsWaitingForExternalTrigger', 'PostSet', @trigCallback);
Please see attachment trigCallback.m for an usage example.
Unlike DAQ Legacy, these events are property event listeners, and these callbacks might execute multiple times because of the internal session object operation.
Thanks,
Jyotish
0 Comments
See Also
Categories
Find more on Data Acquisition Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!