How to simultaneously and continuously run multiple codes?

4 visualizaciones (últimos 30 días)
Diane
Diane el 15 de Mayo de 2014
Respondida: Walter Roberson el 15 de Mayo de 2014
I am trying to continuously run a simulation from MATLAB to Arduino(to receive and send information) and also have a GUI to interact with. The problem I am running into is trying to have one part of my code continuously running, call it A, and be able to have a simulation occur, call it B, while the A is still running. I looked into parallel computing and being able to have A and B running along with sending and receiving information from Arduino, but I believe there is something I am missing to simulate this. Has anyone ever tried this before? Also let me know if you need more detailed explanation.
My original plan was to create 6 scripts/functions: 1 be the communication portal for Arduino to MATLAB, the next would be my GUI, then my original code that always has to be running, the other three would be simulations preformed one at a time.
Thanks! (I currently have R2013a)

Respuestas (1)

Walter Roberson
Walter Roberson el 15 de Mayo de 2014
Instead of having your code continually running to communicate with the Arduino, use serial port callbacks to talk to it as needed. See ReceivedBytesFcn and related serial properties.

Categorías

Más información sobre Instrument Control Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by