Excuting event listeners asynchronously
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Entering Commands finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


