MATLAB Answers

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

조회 수: 3(최근 30일)
shree om bade
shree om bade 2020년 10월 28일
댓글: shree om bade 2020년 11월 6일
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.

답변(1개)

Aman Vyas
Aman Vyas 2020년 11월 3일
편집: Aman Vyas 2020년 11월 3일
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 !

Community Treasure Hunt

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

Start Hunting!

Translated by