I'm trying to run Simulink model and at the same time receiving and processing data in a Matlab script, and sending the result into Simulink to change the behavior of the model.
Since the Matlab scripts should keep receiving and processing data, the only way I can figure out is to use a while(1) loop. However, the simulation seemed to be blocked by the while loop. The simulation time is halted when I run the script. As long as I Ctrl+C to end the script, the simulation continued.
Is there any way to run the simulink simulation and the Matlab script(or function) simultaneously while keeping the interaction between them? Just like executing them in different thread.