how to provide value for parameters from m file to matlab function block in simulink without assigning the parameters inside simulink matlab function

11 visualizaciones (últimos 30 días)
Hi
I am using matlab function block in simulink and really I am having problem in assigning value for some parameters which I have in my m file. If I again assign the same value inside matlab function block then it doesn't make sense to use in m files. so can anybody help me out for this solution.

Respuestas (1)

Aman Vyas
Aman Vyas el 3 de Nov. de 2020
Editada: Aman Vyas el 3 de Nov. de 2020
Hi,
You can give value by following either methods:
A) Make GUI in matlab transfer function ( simulink block ) where directly you can specify value from the matlab file once you have loaded the file.
1) First convert the matlab function block to subsystem by right clicking and selecting create subsytem.
2) Once subsystem is created select Edit mask a pop up will be displayed.
3) From there you can follow either of the following:
a) Either make parameter from Parameters and Dialogs, or
b) Either initialise the values from matlab file to initialization command option.
Alternatively,
The parameters you load into the MATLAB workspace are not visible in the MATLAB Function block because they are not set as parameters of the block nor are they explicit inputs to the block. You will need to go to the Ports and Data Manager option inside the MATLAB Function block and define the variables you load into the MATLAB workspace as parameters for the block. Instructions for that can be found here:
Hope it helps !

Categorías

Más información sobre Schedule Model Components 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