Popup value in Simulink Mask doesn't refresh

4 Ansichten (letzte 30 Tage)
R Phi
R Phi am 16 Jun. 2016
Beantwortet: R Phi am 30 Jun. 2016
I am currently masking a block in simulink. The mask contains a popup list called dbclist with hardcoded type options (1, 2, 3, ..., 7). The callback function of said popup list looks like this:
msk = Simulink.Mask.get(gcb);
dbcPopup = msk.getParameter('dbclist');
dbcPopup.Value
When changing the value of dbclist while using the mask the command window always responds with:
ans =
1
ans =
1
ans =
1
How can I get the actual value of dbclist? I am using MATLAB 2014b on Mac OS X.
  2 Kommentare
sam0037
sam0037 am 23 Jun. 2016
Hi,
I am able to see different results by changing the masked parameter 'dbclist'. I have attached a model for illustration. If I have misunderstood the issue then can you elaborate more on the issue? Also, share a reproduction model if possible.
If you are looking for dynamically populating mask parameter popup list then follow the link below:
R Phi
R Phi am 25 Jun. 2016
Bearbeitet: R Phi am 25 Jun. 2016
Hi Abdus,
thank you very much for answering. Unfortunately I still deal with the same behaviour. I created a minimal model which is attached to this post.
Moreover I will explain my problem a bit more detailed. The task is to mask a simulink block. The mask consists of one button and two popuplists (called dbclist and messagelist) at the moment. The button refreshes the data that is needed for populating both popuplists. In this example this data is hardcoded. The callback of the button looks like this:
keySet = {'1', '2', '3'};
value1 = {'aa', 'bb', 'cc'};
value2 = {'dd', 'ee', 'ff'};
value3 = {'gg', 'hh', 'ii'};
valueSet = {value1, value2, value3};
mapObj = containers.Map(keySet, valueSet);
msk = Simulink.Mask.get(gcb);
dbcPopup = msk.getParameter('dbclist');
dbcPopup.TypeOptions = keys(mapObj);
The first popuplist (dbclist) should let you choose between 1, 2 and 3. If you select 1 the type options of the second popuplist (messagelist) should be aa, bb and cc. If you select 2 you can choose between dd, ee and ff and finally by selecting 3 you should get the type options gg, hh and ii.
To achieve such a behaviour the callback of the first popuplist (dbclist) looks like this:
msk = Simulink.Mask.get(gcb);
dbcPopup = msk.getParameter('dbclist');
msgPopup = msk.getParameter('messagelist');
dbcPopup.Value
try
tmpList = values(mapObj, {dbcPopup.Value});
tmpList = tmpList{1};
msgPopup.TypeOptions = tmpList;
catch ME
end
dbcPopup.Value in the fourth row is only called to monitor the value which unfortunately never changes. What am I doing wrong? :-(

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

R Phi
R Phi am 30 Jun. 2016
I have found a solution. I am getting the correct value by using
vals = get_param(gcb,'MaskValues');
dbcValue = vals{1}
instead of
msk = Simulink.Mask.get(gcb);
dbcPopup = msk.getParameter('dbclist');
dbcPopup.Value
I still don't know what is wrong with the first approach, especially because it works for Abdus. I would really appreciate iff someone figures out what is wrong.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by