0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function g_AnnotationUpdate(paramlist,varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % Update the block annotation (the text below the block) with all the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % current parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 global selBlocks paramEnabled
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 annotation = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 numparams = nparams(paramlist);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 firstpar = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 if strcmpi(get_param(gcbh,'Tag'),'arithmetic')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 eq = get(findobj('Tag','equationField'),'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 if ~isempty(eq)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 if numel(eq)>40, eq(1:end-25) = []; eq = ['...',eq]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 for nn=1:length(selBlocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 set_param(selBlocks(nn),'AttributesFormatString',eq);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 for kk=1:numparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 if paramEnabled(kk)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 paramkey = paramlist.params(kk).key;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 try %#ok<ALIGN>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 if strcmpi(paramkey(1:7),'addPar_'), paramkey(1:7)=[]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 catch, end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 paramval = paramlist.params(kk).val;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 switch class(paramval)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 case 'specwin'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 windowName = paramval.type;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 windowlength = size(paramval.win,2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 if firstpar==1 % it's the first parameter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 annotation = ['(specwin) ',windowName,',',num2str(windowlength)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 else % it's not the first parameter
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 annotation = [annotation,'\n','(specwin) ',windowName,',',num2str(windowlength)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 if strcmp(windowName,'Kaiser')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 windowPsll = paramval.psll;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 annotation = [annotation,',',num2str(windowPsll)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 case 'double'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 paramval = mat2str(paramval);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 if numel(paramval)>25, paramval=['...',paramval(end-25:end)]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 if firstpar==1, annotation=[lower(paramkey),' ',paramval]; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 else annotation = [annotation,'\n',lower(paramkey),' ',num2str(paramval)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 case 'char'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 if numel(paramval)>25, paramval=['...',paramval(end-25:end)]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 paramval = strrep(paramval,'''''','''');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 if firstpar==1, annotation=[lower(paramkey),' ',paramval]; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 else annotation = [annotation,'\n',lower(paramkey),' ',paramval];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 case 'logical'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 if paramval, paramval = 'true'; else paramval = 'false'; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 if firstpar==1, annotation=[lower(paramkey),' ',paramval]; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 else annotation = [annotation,'\n',lower(paramkey),' ',paramval];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 case 'pzmodel'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 if firstpar==1, annotation='(pzmodel)'; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 else annotation = [annotation,'\n','(pzmodel)'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 if isa(paramval{1},'char') && strcmp(paramval{1},'(-->)'), strParKey = '(-->)';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 else strParKey = utils.prog.cell2str(paramval);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 if firstpar==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 annotation = [lower(paramkey),' ',strParKey]; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 else annotation = [annotation,'\n',lower(paramkey),' ',strParKey];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 case 'pz'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 for mm=1:numel(paramval)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 poleFreqs(mm,1) = paramval(mm).f;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 poleQs(mm,1) = paramval(mm).q;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 if ~isnan(poleQs(mm,1))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 poleFQs{mm,1}=strcat(num2str(poleFreqs(mm,1)),',',num2str(poleQs(mm,1)));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 poleFQs{mm,1}=num2str(poleFreqs(mm,1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 poleFQs=char(poleFQs);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 if firstpar==1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 annotation = ['pz ',poleFQs(1,:)]; firstpar=2;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 for j=2:size(poleFQs,1), annotation = [annotation,'\n','(pz) ',poleFQs(j,:)]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 annotation = [annotation,'\n','pole ',poleFQs(1,:)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 for j=2:size(poleFQs,1), annotation = [annotation,'\n','(pz) ',poleFQs(j,:)]; end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % Finally set the block annotation:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 for nn=1:length(selBlocks), set_param(selBlocks(nn),'AttributesFormatString',annotation); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 end
|