Cannot change "MaskValues" parameter

4 ビュー (過去 30 日間)
Paulus Potter
Paulus Potter 2016 年 11 月 30 日
編集済み: Paulus Potter 2016 年 12 月 1 日
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?

採用された回答

Paulus Potter
Paulus Potter 2016 年 12 月 1 日
編集済み: Paulus Potter 2016 年 12 月 1 日
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!

その他の回答 (1 件)

Ganesh Hegade
Ganesh Hegade 2016 年 11 月 30 日
編集済み: Ganesh Hegade 2016 年 11 月 30 日
Hi,
Please try to get the object of the block and assign the properties and check.
oBlock = eval(LED);
oBlock.SetPropertyList([maskPrompts, maskValues])

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by