how to provide value for parameters from m file to matlab function block in simulink without assigning the parameters inside simulink matlab function
조회 수: 1 (최근 30일)
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.
Aman Vyas 2020년 11월 3일
편집: Aman Vyas 님. 2020년 11월 3일
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.
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 !