Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Wait for another file to execute before the caller continues to execute!!

2 vues (au cours des 30 derniers jours)
Bolivar
Bolivar le 14 Oct 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello, I come across a difficulty when working on my project and I will appreciate if someone can help me push that botelneck away. Actually, I want a function callback midst in its file to pause and wait for another callback to provide it with data before it continues.
So that is how my code look like :
classdef user < handle
events
REPLY
REQUEST
end
methods
function obj= user
end
function AddListener(arg)
addlistener(arg,'REQEST',@(src,evnt)reply(obj,src,evnt));
addlistener(arg,'REPLY',@(src,evnt)request(obj,src,evnt));
end
function reply(obj,src,evnt)
step1
step2
notify(obj,'REPLY',eventData(sendingdata));
end
function request(obj,varargin)
step1
step2
notify(obj,'REQUEST');
for i=1:(4/0.1)
pause(0.1);
end % end for loop
step3
step4
end
end %end methods block
end %end class
the class user defines object which exchange data interactively. We create two objects
user1 = user; and user2=user; add listener to each other by
user1.AddListener(user2);
user2.AddListener(user1);
Then we start the proces by
user1.request();
instead of waiting reply-callback from user2, request from user1 run to the end.
What can i do to eleviate that issue?
thanks for your help!
Bolivar

Réponses (0)

Cette question est clôturée.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by