synchronizing simulink with m-file

5 visualizaciones (últimos 30 días)
Tan Edwin
Tan Edwin el 14 de Abr. de 2011
im need to synchronize output from simulink with MATLAB platform
currrently what im using is (running in matlab platform)
rto = get_param(gcb,'RuntimeObject');
blockData = rto.OutputPort(1).Data ;
but it only gives me one data and it requires me to run it manaully. Need it to run in MATLAB platform automatically and in sync with the Simulink model.
Advise/Direction needed thanks.

Respuesta aceptada

Jarrod Rivituso
Jarrod Rivituso el 14 de Abr. de 2011
You can add a listener callback that runs when the block creates outputs:
h = add_exec_event_listener(gcb, 'PostOutputs', @callbackFcn);
More information is found here under "Listening for Method Execution Events".
  1 comentario
Jarrod Rivituso
Jarrod Rivituso el 14 de Abr. de 2011
I should mention also that there are blocks you can include in your model that will allow you to run MATLAB code from within Simulink, such as the "MATLAB Function" block, or the MATLAB S-function block.

Iniciar sesión para comentar.

Más respuestas (1)

Tan Edwin
Tan Edwin el 18 de Abr. de 2011
How do i actually add this code in?
let say my i want to call is:
function rto=access()
rto = get_param(gcb,'RuntimeObject');
blockData = rto.OutputPort(1).Data ;
rto %to get output into MATLAB workspace every iteration in simulink
So can i place the event listener into a lvl-1 S-function block or does it only works for lvl2 S-function block? where should i place it? in the update/output?
  6 comentarios
Tan Edwin
Tan Edwin el 20 de Abr. de 2011
Thanks alot for the advices. Will look into signal logging method.
By the way the link is not working.
Jarrod Rivituso
Jarrod Rivituso el 20 de Abr. de 2011
Ooops, looks like it changed. Here ya go
http://www.mathworks.com/help/toolbox/simulink/ug/f11-47048.html

Iniciar sesión para comentar.

Categorías

Más información sobre Event Functions en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by