I have a Simulink model and a GUI made in app designer from which I control said model. So far I have been able to let the GUI and the Simulink model communicate both ways. The GUI sets parameter constant blocks in the model using set_param whereas the model updates the GUI through a callback using add_exec_event_listener. The GUI object resides in the model workspace.
In the startup callback of the model StartFcn I have the following code
blk = [model '/q-log'];
event = 'PostOutputs';
app = getVariable(get_param(bdroot,'ModelWorkspace'),'app');
listener = @(obj,event) updategui(obj,event,app);
h = add_exec_event_listener(blk, event, listener);
The problem with this setup is that it is extremely slow. I'm not quite sure how to get it faster and if this is the way to go. I've looked at a lot of examples but none detail my needs.
So my question is if there is a faster or more efficient way to update the GUI fields and plots? It doesn't have to be hard real time but writing variables to workspace and importing it into the GUI afterwards not is not acceptable.