I am using a Simulink to collect data real-time from drop tests. The Simulink works great, but my vision is to have a Matlab (v.7.10) script run the simulation for several trials without me having to run over to the computer between drops. This also allows me to pre-process the data before saving it. Both programs work great individually, but I cannot make the Simulink run properly in a script. Using sim()
returns the error message:
Cannot perform command line simulation of 'acc_DAC' in external mode.
Using set_param(sys, 'SimulationCommand', 'start')
starts the simulation, but does not block the script. The script continues and returns errors because the outputs it is supposed to have don't exist yet. Notably, I read elsewhere that pausing Matlab will pause any simulations as well, though I couldn't get that far myself.
The Simulink runs until the impact is measured, and then stops and outputs accelerometer data to the workspace. What I am asking is:
A) Is there a way to sim()
run an external, real-time simulation?
B) Is there a good way to make Matlab wait for either Simulink to finish, or variables to exist, without pausing the Simulink?
init_sim
andstart
to work, and the simulation would finish and unload, but the script wouldn't progress any further. My guess is that theevalin
command I stuck in the end of the Simulink wasn't working properly but have no idea where to go with that. - Spencer Williams