Excuting event listeners asynchronously
이전 댓글 표시
Please run below
hedt = uicontrol('Style','edit','Callback',@edt_callback);
addlistener(hedt, 'String', 'PostSet', @listener_1);
addlistener(hedt, 'String', 'PostSet', @listener_2);
addlistener(hedt, 'String', 'PostSet', @listener_3);
function edt_callback(~,~)
disp('edt callback ends')
end
function listener_1(~,~)
pause(1)
disp('listener 1 ends')
end
function listener_2(~,~)
pause(2)
disp('listener 2 ends')
end
function listener_3(~,~)
pause(3)
disp('listener 3 ends')
end
it takes ~6 second and listener_3 results first, which has longest pause time.
>> test_script
listener 3 ends
listener 2 ends
listener 1 ends
edt callback ends
so, obviously, all listeners linked to a event shall be excuted in serial (on by one) in Matlab.
I hope to run all listeners asynchronously, i.e. in seperated thread.
what would be my option?
Thank you.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


