How to stop a sub function after certain time from main function ?

조회 수: 2 (최근 30일)
Akash Pal
Akash Pal 2022년 5월 11일
답변: Walter Roberson 2022년 5월 11일
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
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.
Akash Pal
Akash Pal 2022년 5월 11일
Thank you .
Let me clarify my programming details,
See i have a main function
function [ x , y , z, a, b ,c]=mainfun(in1 ,in2,...)
[x,y,z]=subfun1(input);
[a,b,c]=subfun2(input)
end
so ,my question is if i want to stop/cancel my subfun2 after 30 minutes ,because i know it will take too much time but i want to visualize the result of other sub function , then what to do ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
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.

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by