Matlab Gui running 2 functions simultaneously
Mostra commenti meno recenti
Hello dear community,
I record road lines via my camera and I display it in "Axes". Besides I have an code for running motors on arduino.
I process road lines and I find the direction of the robot with my code.
I would like my gui to display the camera and run motors.
I would like to use 2 pushbutton. One is for display, one is for running motors. However matlab doesnt do them at the same time.
How can I do that simultaneously?
Thanks in advance
-Ilker
Risposte (1)
Walter Roberson
il 28 Mar 2016
0 voti
You cannot do that. You want two different graphics callbacks to take control and not return. MATLAB can only run one graphics callback at a time.
If you investigate further you will find that neither of your callbacks needs a dedicated CPU: both of them spend most of their time waiting for something (a frame, or for the communications channel to be ready.) The communications with the motor is probably the easier to rewrite in terms of callbacks, using BytesAvailableFcn for input and OutputEmptyFcn for output. Those will ask for attention when they need it. Meantime, your camera display routine will be updating the screen using pause() or drawnow(), and both of those functions give a chance for other callbacks to run, so you will not need to do anything special in your display code to specifically allow the serial callbacks to run.
Categorie
Scopri di più su Arduino Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!