0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function varargout = loopgui(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % LOOPGUI M-file for loopgui.fig
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % LOOPGUI, by itself, creates a new LOOPGUI or raises the existing
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % singleton*.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % H = LOOPGUI returns the handle to a new LOOPGUI or the handle to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % the existing singleton*.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % LOOPGUI('CALLBACK',hObject,eventData,handles,...) calls the local
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 % function named CALLBACK in LOOPGUI.M with the given input arguments.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % LOOPGUI('Property','Value',...) creates a new LOOPGUI or raises the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % existing singleton*. Starting from the left, property value pairs are
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 % applied to the GUI before loopgui_OpeningFunction gets called. An
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % unrecognized property name or invalid value makes property application
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % stop. All inputs are passed to loopgui_OpeningFcn via varargin.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 % instance to run (singleton)".
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 % See also: GUIDE, GUIDATA, GUIHANDLES
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % Edit the above text to modify the response to help loopgui
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % Last Modified by GUIDE v2.5 12-Jun-2007 20:24:04
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % Begin initialization code - DO NOT EDIT
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 gui_Singleton = 0;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 gui_State = struct('gui_Name', mfilename, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 'gui_Singleton', gui_Singleton, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 'gui_OpeningFcn', @loopgui_OpeningFcn, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 'gui_OutputFcn', @loopgui_OutputFcn, ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 'gui_LayoutFcn', [] , ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 'gui_Callback', []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 if nargin && ischar(varargin{1})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 gui_State.gui_Callback = str2func(varargin{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 if nargout
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 gui_mainfcn(gui_State, varargin{:});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % End initialization code - DO NOT EDIT
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % --- Executes just before loopgui is made visible.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 function loopgui_OpeningFcn(hObject, eventdata, handles, varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 % This function has no output args, see OutputFcn.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % hObject handle to figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 % varargin command line arguments to loopgui (see VARARGIN)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % Choose default command line output for loopgui
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 handles.output = hObject;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % Update handles structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 guidata(hObject, handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % UIWAIT makes loopgui wait for user response (see UIRESUME)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % uiwait(handles.main);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 set(handles.loopLevelSelect, 'String', {'1','2','3','4','5'});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 set(handles.loopLevelSelect, 'Value', 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 % get my block handles
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 myh = get_param(gcb, 'handle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 setappdata(handles.main, 'loopBlockHandle', myh);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 % parse model elements and get block list that
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 % have parameters that can be looped over
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 blockhandles = find_system(gcs, 'FindAll', 'on', 'type', 'block');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 blocks = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 k = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 for j=1:length(blockhandles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 b = blockhandles(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 maskType = get(b, 'MaskType');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 if ~strcmp(maskType, 'loop')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 maskParams = get(b, 'MaskNames');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 get(b)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 if ~isempty(maskParams)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 name = get(b, 'Name');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 if ~strcmp(name, 'variable')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 parent = get(b, 'Parent');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 name = [parent '/' name];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 blocks(k).handle = b;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 blocks(k).name = name;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 k = k+1;
|
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 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 setappdata(handles.main, 'blocks', blocks);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % Fill list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 bnames = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 for j=1:length(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 bnames = [bnames cellstr(blocks(j).name)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 set(handles.blockList, 'String', bnames)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % get current loop
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 getLoop(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 % set current value for selected block/param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 setCurrentValues(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 % show current block settings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 showBlockSettings(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 % get the current loop and set lists accordingly
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 function getLoop(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 myh = getappdata(handles.main, 'loopBlockHandle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 blocks = getappdata(handles.main, 'blocks');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 set(handles.main, 'Name', get(myh, 'Name'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 %--------- Set indices for lists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % get mask values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 maskVals = get(myh, 'MaskValues');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 bname = maskVals{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 % find block in list which matches the current loop settings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 blistIdx = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 for j=1:length(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 b = blocks(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 if strcmp(b.name, bname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 blistIdx = j;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 set(handles.blockList, 'Value', blistIdx)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 % set params list
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 setParamsList(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 % set param to the key in loop block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 params = get(handles.paramList, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 param = maskVals{3};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 pidx = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 for j=1:length(params)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if strcmp(params{j}, param)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 pidx = j;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 set(handles.paramList, 'Value', pidx);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 % set parameters list from currently selected block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 function setParamsList(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % get block handle
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 bhandle = getblockhandle(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 % get mask params for this block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 maskparams = get(bhandle, 'MaskNames');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 set(handles.paramList, 'String', maskparams);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 % --- Outputs from this function are returned to the command line.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166 function varargout = loopgui_OutputFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 % varargout cell array for returning output args (see VARARGOUT);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 % hObject handle to figure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 % Get default command line output from handles structure
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 varargout{1} = handles.output;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 % --- Executes on selection change in popupmenu1.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 function popupmenu1_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 % hObject handle to popupmenu1 (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 % Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 % contents{get(hObject,'Value')} returns selected item from popupmenu1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 function popupmenu1_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % hObject handle to popupmenu1 (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 % Hint: popupmenu controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 % --- Executes on selection change in blockList.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 function blockList_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 % hObject handle to blockList (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 % Hints: contents = get(hObject,'String') returns blockList contents as cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 % contents{get(hObject,'Value')} returns selected item from blockList
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 set(handles.paramList, 'Value', 1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 setParamsList(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 setCurrentValues(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 function blockList_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 % hObject handle to blockList (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 % Hint: listbox controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 % --- Executes on selection change in paramList.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 function paramList_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 % hObject handle to paramList (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 % Hints: contents = get(hObject,'String') returns paramList contents as cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 % contents{get(hObject,'Value')} returns selected item from paramList
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 setCurrentValues(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 % Set values edit box to current value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 function setCurrentValues(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 param = getparam(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 bh = getblockhandle(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 blocks = getappdata(handles.main, 'blocks');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 % find relevant block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 for j=1:length(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 b = blocks(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 if b.handle == bh
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 % get maskNames
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 maskparams = get(bh, 'MaskNames');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 for k=1:length(maskparams)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 if strcmp(maskparams{k}, param)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 validx = k;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % get mask values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 maskvals = get(bh, 'MaskValues');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 set(handles.paramValsEdit, 'String', maskvals{validx})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 function paramList_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 % hObject handle to paramList (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 % Hint: listbox controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 function paramValsEdit_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 % hObject handle to paramValsEdit (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 % Hints: get(hObject,'String') returns contents of paramValsEdit as text
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 % str2double(get(hObject,'String')) returns contents of paramValsEdit as a double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 function paramValsEdit_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 % hObject handle to paramValsEdit (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 % Hint: edit controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 % --- Executes on button press in setLoopBtn.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 function setLoopBtn_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301 % hObject handle to setLoopBtn (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 % get block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 bh = getblockhandle(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 bname = getblockname(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 % get param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 param = getparam(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 % get values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 vals = cellstr(get(handles.paramValsEdit, 'String'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 level = get(handles.loopLevelSelect, 'Value');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 setBlockSettings(handles, bh, bname, param, vals, 'on', level)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 % get name of currently selected param
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321 function param = getparam(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 params = get(handles.paramList, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 param = params{get(handles.paramList, 'Value')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 % get block name of currently selected block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 function bname = getblockname(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 bnames = get(handles.blockList, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 bname = bnames{get(handles.blockList, 'Value')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 % get block handle of currently selected block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 function bh = getblockhandle(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 % get possible blocks
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 blocks = getappdata(handles.main, 'blocks');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 % which block is selected
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 blist = get(handles.blockList, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 bsel = blist{get(handles.blockList, 'Value')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 % get handle for selected block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 for j=1:length(blocks)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 if strcmp(blocks(j).name, bsel)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 bh = blocks(j).handle;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 % Show current setting on GUI
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 function showBlockSettings(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 % get settings from block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 myh = getappdata(handles.main, 'loopBlockHandle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % get mask values
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 maskVals = get(myh, 'MaskValues')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 % set fields on gui
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 set(handles.blockname, 'String', maskVals{1});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 set(handles.blockhandle, 'String', maskVals{2});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 set(handles.blockkey, 'String', maskVals{3});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 set(handles.blockvals, 'String', maskVals{4});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 level = str2num(maskVals{6})
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 if isempty(level)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 level = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 if level < 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 level = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 if level > 5
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 level = 5;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 set(handles.loopLevelSelect, 'value', level);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 set(handles.blocklevel, 'String', maskVals{6});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 % Set current block settings to those selected
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 function setBlockSettings(handles, bh, bname, key, vals, state, level)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 % get settings from block
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 myh = getappdata(handles.main, 'loopBlockHandle');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 maskvals = {bname num2str(bh,20) key cell2str(vals) state num2str(level)};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 set(myh, 'MaskValues', maskvals);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 showBlockSettings(handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 % Convert a cell array to a space separated list of strings
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 function str = cell2str(c)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 str = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 for j=1:length(c)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 str = [str ' ' c{j}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 str = strtrim(str);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 % --- Executes on button press in getLoopBtn.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 function getLoopBtn_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 % hObject handle to getLoopBtn (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410 getLoop(handles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 % --- Executes on selection change in loopLevelSelect.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 function loopLevelSelect_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 % hObject handle to loopLevelSelect (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 % Hints: contents = get(hObject,'String') returns loopLevelSelect contents as cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 % contents{get(hObject,'Value')} returns selected item from loopLevelSelect
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 function loopLevelSelect_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 % hObject handle to loopLevelSelect (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 % Hint: popupmenu controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 % --- Executes on selection change in loopLevelSelect.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 function popupmenu4_Callback(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 % hObject handle to loopLevelSelect (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 % handles structure with handles and user data (see GUIDATA)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442 % Hints: contents = get(hObject,'String') returns loopLevelSelect contents as cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 % contents{get(hObject,'Value')} returns selected item from loopLevelSelect
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 % --- Executes during object creation, after setting all properties.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 function popupmenu4_CreateFcn(hObject, eventdata, handles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448 % hObject handle to loopLevelSelect (see GCBO)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 % eventdata reserved - to be defined in a future version of MATLAB
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 % handles empty - handles not created until after all CreateFcns called
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 % Hint: popupmenu controls usually have a white background on Windows.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 % See ISPC and COMPUTER.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 set(hObject,'BackgroundColor','white');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458
|