Can I notify a listener from a batch job?

1 回表示 (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2021 年 8 月 25 日
回答済み: MathWorks Support Team 2021 年 10 月 7 日
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?

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 8 月 25 日
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 件)

タグ

タグが未入力です。

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by