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 で App Building についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


