Borrar filtros
Borrar filtros

Get and set Simulink model data from Matlab?

1 visualización (últimos 30 días)
Lucas
Lucas el 17 de Mayo de 2012
I have a simple model with 1 input and output. The input it directly linked to the output. I was wondering if there was any way I could get the input name, set a value to it, run it and see if the output matches the input. I want to try and do this from an .M file if possible. Thanks!

Respuesta aceptada

K E
K E el 17 de Mayo de 2012
Perhaps this explanation of the get_param and set_param commands will help. You could use get_param and set_param from within a mfile that uses the sim command to run the simulation. If your input and output are scalars, just take their difference in the mfile after the sim command. If they are time series,
isDifferent = sum(myInput - myOutput) ~= 0 ;
  3 comentarios
K E
K E el 17 de Mayo de 2012
If you are doing this from inside a Matlab script, you could use the disp command (http://www.mathworks.com/help/techdoc/ref/disp.html) to display the value returned by get_param at the Matlab prompt. Or you could make a GUI to show it but I don't know the details.
Kaustubha Govind
Kaustubha Govind el 18 de Mayo de 2012
Lucas: You can use the Inport/Outport blocks to import/export data using the "Data Import/Export" pane of the model's Configuraion Parameters window. See here for more explanation: http://www.mathworks.com/help/toolbox/simulink/ug/bsuwmmp.html

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by