Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_fromSimulinkCallback.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function g_fromSimulinkCallback(hObject, varargin) | |
2 | |
3 global params paramEnabled functionName objName paramSets | |
4 | |
5 currParamIndex = str2double(get(hObject,'Tag')); | |
6 status = get(hObject,'Value'); % 1 activated, 0 deactivated | |
7 paramval = get(hObject,'UserData'); | |
8 paramKey = params.params(currParamIndex).key; | |
9 if status %activated | |
10 for mm=3:9, try set(objName{currParamIndex,mm},'Visible','off'); catch, end; end | |
11 if ~isempty(paramval) | |
12 params = pset(params,paramKey,{'-->'}); | |
13 else | |
14 params = pset(params,paramKey,'-->'); | |
15 end | |
16 paramEnabled(currParamIndex) = 1; | |
17 presentBlock = utils.prog.find_in_models(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(paramKey)); | |
18 if ~isempty(presentBlock), set_param(presentBlock{1},'Name',[lower(paramKey),'_fun']); end | |
19 g_UpdateInports(paramKey,1) | |
20 else %deactivated | |
21 for mm=3:9, try set(objName{currParamIndex,mm},'Visible','on'); catch, end; end | |
22 % Retrieve the original param: | |
23 [func,currClass] = strtok(get(gcbh,'Tag')); | |
24 infoObj = eval([currClass,'.getInfo(''',functionName,''')']); | |
25 if numel(infoObj.sets) > 1 | |
26 currSet = find(paramSets,'currSet'); | |
27 origParams = infoObj.plists(currSet); | |
28 else | |
29 origParams = infoObj.plists; | |
30 end | |
31 paramKey = params.params(currParamIndex).key; | |
32 origPar = find(origParams,paramKey); | |
33 if isempty(origPar), origPar = 1; end | |
34 params = pset(params,paramKey,origPar); | |
35 paramEnabled(currParamIndex) = 0; | |
36 g_UpdateInports(paramKey,-1) | |
37 end | |
38 | |
39 g_ApplyButtonCallback([],1) | |
40 | |
41 end |