How to simultaneously and continuously run multiple codes?

4 ビュー (過去 30 日間)
Diane
Diane 2014 年 5 月 15 日
回答済み: Walter Roberson 2014 年 5 月 15 日
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)

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 5 月 15 日
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.

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by