How to stop a sub function after certain time from main function ?
2 次查看(过去 30 天)
显示 更早的评论
I want to stop a sub function of my main function after a certain time and want to get the other sub function result at the same time ,How to do it ?
2 个评论
Geoff Hayes
2022-5-11
@Akash Pal please clarify with a small example what you wish to happen. Is your main function calling another function which you wish to "cancel" after a certain period of time (if it hasn't completed)? If so, please describe the scenario as to why you would want to do this.
回答(1 个)
Walter Roberson
2022-5-11
If you use parfeval() then you can cancel() the future.
However when you cancel a future you do not have access to its workspace. You cannot use this method to get "best results so far" from the worker.
If you create Parallel Data Queues then you can use them to send requests some kinds of workers. But this approach requires cooperation with the worker.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!