Parameters from MATLAB function in Simulink

1 visualización (últimos 30 días)
Jasper Mattijs
Jasper Mattijs el 6 de Mayo de 2014
Comentada: Santosh Gnanasekaran el 1 de En. de 2018
Hi
I'm writing a function in MATLAB. In this function I call a Simulink diagram with following command: sim('diagram', 'vxin', value) The error I get is: block_diagram does not have a parameter named 'vxin'. In the diagram I have a constant block where I entered vxin. Clearly this isn't the right way.
How can I fix this?
Thanks
  1 comentario
Santosh Gnanasekaran
Santosh Gnanasekaran el 1 de En. de 2018
Probably 'vxin' is not in the base workspace as its value is undefined. you can assign any constant\variable in simulink pertaining to that particular block and then try again.

Iniciar sesión para comentar.

Respuesta aceptada

A Jenkins
A Jenkins el 6 de Mayo de 2014
Editada: A Jenkins el 6 de Mayo de 2014
It depends on how you want to manage the scope of vxin .
Simple option:
vxin=value;
sim('diagram');
or maybe you want something like:
h=get_param('diagram','modelworkspace');
h.assignin('vxin',value);
sim('diagram');

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by