Can I notify a listener from a batch job?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 25 Aug 2021
Answered: MathWorks Support Team
on 7 Oct 2021
I have an App Designer application where I need to launch a computational routine in the background while a user can still click around and use the app. I tried implementing a listener and notifying the listener in the batch job, but the listener was never triggered. However, when I call this in process (without batch), the listener is triggered.
How can I configure this listener properly?
Accepted Answer
MathWorks Support Team
on 25 Aug 2021
Unfortunately you cannot trigger a listener from a batch job. However, as a workaround, you can use the parfeval function in conjunction with DataQueues .
A DataQueue object allows you to asynchronously share data between workers in a parallel pool and the client (in this case, the App Designer application). You can call parfeval instead of batch to run your desired function asynchronously while still allowing the end user to interact with the application. You can specify which function to call after data is received by the DataQueue using the afterEach function.
To actually send data to the DataQueue, call the send function from within the function that you're submitting as a batch job.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!