I cannot call parameter value from workspace to Simulink matlab function block

Hello,
I want to call a parameter value from workspace to Simulink matlab function block. But, it doesn't work.
function y = AAA( var1)
BB= var1
CC = 'parameter in workspace' * BB
y=CC

Respuestas (1)

Hi @mg
Make the function like this:
function y = AAA( var1,param1)
BB= var1
CC = param1 * BB
y=CC
Then, follow the instructions at this link to specify the scope of param1 as 'parameter'.
param1 will not show up as an input to the Matlab Function block in the block diagram.
Set the value of param1 in your base workspace and then simulate your model
>> param1 = 5;

Categorías

Más información sobre Simulink Functions en Centro de ayuda y File Exchange.

Preguntada:

mg
el 13 de En. de 2023

Respondida:

el 13 de En. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by