Cannot change "MaskValues" parameter

3 visualizaciones (últimos 30 días)
Paulus Potter
Paulus Potter el 30 de Nov. de 2016
Editada: Paulus Potter el 1 de Dic. de 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:
set_param(currBlk,'MaskPrompts',maskPrompts)
set_param(currBlk,'MaskVisibilities',maskVis)
set_param(currBlk,'MaskValues',maskValues)
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
get_param(currBlk,'MaskValues')
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?

Respuesta aceptada

Paulus Potter
Paulus Potter el 1 de Dic. de 2016
Editada: Paulus Potter el 1 de Dic. de 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)
set_param(currBlk,controlNames{i},my_values_cell{i})
end
This works!

Más respuestas (1)

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

Categorías

Más información sobre Author Block Masks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by