필터 지우기
필터 지우기

How can we set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands?

조회 수: 3 (최근 30일)
In Matlab 2015B, working on simulink Dashboard elements, how can we set parameter values like Minimum or Maximum for a Slider and bind the Slider to a tunable block like a Constant, using matlab commands?
I tried using the steps in this link:
Given below is an example snippet from this link:
----------------------------------------------------------------------------------------------------------
Connect and Configure the Slider Block
Use a Simulink.HMI.ParamSourceInfo object and the set_param function to connect the Slider block to the Gain parameter of the Mublock. To connect a parameter, the Simulink.HMI.ParamSourceInfo needs to specify the block path for the block that corresponds to the parameter and the name of the parameter.
slider_param = Simulink.HMI.ParamSourceInfo;
slider_param.BlockPath = Simulink.BlockPath('vdp/Mu');
slider_param.ParamName = 'Gain';
set_param('vdp/Slider',"Binding",slider_param)
Configure the scale for the slider for a range of 1 to 10 with a tick mark spacing of 1.
slider_limits = [1 1 10];
set_param('vdp/Slider',"Limits",slider_limits)
----------------------------------------------------------------------------------------------------------
In the above example, The set_param statements setting the "Binding" or "Limits" parameters do not work for me and result in the following error:
MWDashboardBlock block (mask) does not have a parameter named 'Binding'
MWDashboardBlock block (mask) does not have a parameter named 'Limits'
How do I get these set_param statements to work? Also, I do not understand the reason for usage of double quotes in setting the "Binding" and "Limits" parameters.
If the above example is incompatible with Matlab 2015B, then what would be an alternative method in Matlab 2015B to set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands? I have not yet found a different example that illustrates this.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2019년 9월 16일
"abc" marks the string data type, which is introducted in R2016b. You can just use 'Binding' in R2015b.
  댓글 수: 3
Fangjun Jiang
Fangjun Jiang 2019년 9월 17일
The example in your link is for later versions (R2019a or R2019b). Sometimes there are incompatibilities between versions. That is all.
Arun Joe Joseph
Arun Joe Joseph 2019년 9월 17일
편집: Arun Joe Joseph 2019년 9월 17일
Thanks, Fangjun. If the above example is incompatible with Matlab 2015B, then what would be an alternative method in Matlab 2015B to set parameter values like Minimum or Maximum for a Slider and bind it to a tunable block like a Constant, using matlab commands? I have not yet found a different example that illustrates this.
I have edited the original question to bring more clarity to the problem. I would be grateful if anyone could help solve this.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Control Simulations with Interactive Displays에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by