Cannot change "MaskValues" parameter

12 Ansichten (letzte 30 Tage)
Paulus Potter
Paulus Potter am 30 Nov. 2016
Bearbeitet: Paulus Potter am 1 Dez. 2016
I have created a LED indicator library which uses a mask. The LED can change color based on different input values. The condition when to change color can be set within a self created mask parameters dialog and a dropdown box is used to select the state you want to change conditions for. See the image below for an example:
So, when I change the "Show parameters for condition", the edit boxes prompts and values of "Condition no.2 lower limit" should change to its corresponding value. Same holds for upper limit and the color. To achieve this, I use the following lines in a callback function of the dropdown box:
where maskPrompts, maskVis and maskValues are cell arrays with the correct values and currBlk is the handle to mask parameters dialog. However, when I execute the last line, the values do not change. That is, when I execute the set_param line and execute
the values are unchanged. MaskPrompts and MaskVisiblities are working fine. In Matlab 6.5 this used to work fine, but in Matlab 2015b this does not seem to work anymore. Is there any settings that blocks change of this setting? I already tried to enable the "Evaluate" and "Tunable" settings for these controls, but this doesn't seem to have any effect.
Any suggestions?

Akzeptierte Antwort

Paulus Potter
Paulus Potter am 1 Dez. 2016
Bearbeitet: Paulus Potter am 1 Dez. 2016
Had contact with Mathworks. It appears that from Matlab 2014b, setting the 'MaskValues' through set_param in a callback function is not possible anymore. The work around is to set the parameter of each dialog control individually:
% Retrieve all dialog control names
controlNames = fieldnames(get_param(currBlk,'DialogParameters'));
for i=1:length(controlNames)
This works!

Weitere Antworten (1)

Ganesh Hegade
Ganesh Hegade am 30 Nov. 2016
Bearbeitet: Ganesh Hegade am 30 Nov. 2016
Please try to get the object of the block and assign the properties and check.
oBlock = eval(LED);
oBlock.SetPropertyList([maskPrompts, maskValues])

Community Treasure Hunt

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

Start Hunting!

Translated by