Mercurial > hg > camir-aes2014
comparison toolboxes/MIRtoolbox1.3.2/somtoolbox/som_gui.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function som_gui(varargin) | |
2 | |
3 %SOM_GUI A GUI for initialization and training of SOM. | |
4 % | |
5 % som_gui([sD]) | |
6 % | |
7 % som_gui | |
8 % som_gui(sD) | |
9 % | |
10 % Input and output arguments ([]'s are optional) | |
11 % [sD] (struct) SOM data struct | |
12 % (matrix) a data matrix, size dlen x dim | |
13 % | |
14 % Actually, there are more arguments the function takes, but | |
15 % they are for internal action of the function only. DO NOT use | |
16 % them. | |
17 % | |
18 % For a more throughout description, see the online documentation. | |
19 % See also PREPROCESS. | |
20 | |
21 %%%%%%%%%%%% DETAILED DESCRIPTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
22 % | |
23 % IN FILES: som_gui.html,browsewin.jpg,wspace.jpg,loadgui.jpg,initgui.jpg,questdlg.jpg,paragui.jpg,mwindow.jpg,visgui.gif,reload.gif,savemap.gif,browse.gif | |
24 % | |
25 | |
26 % Contributed to SOM Toolbox vs2, February 2nd, 2000 by Mika Pollari | |
27 % Copyright (c) by Mika Pollari and SOM Toolbox Team | |
28 % http://www.cis.hut.fi/projects/somtoolbox/ | |
29 | |
30 % Mika Pollari 31.1.2000 vs 1.1 | |
31 | |
32 global NEWMAP NEWST MAPSAVED MAP DATA LOAD_NAME LOAD_DATA; | |
33 global SAVEMAP ALGORITHM HANDLE2 STOPOLINIT INIT_TYPE; | |
34 global STRAIN1 STRAIN2 SOTHERS; | |
35 | |
36 if nargin == 0 | |
37 main_gui; | |
38 action = 'dummy'; | |
39 elseif nargin == 1 | |
40 temp = varargin{1}; | |
41 if isstruct(temp), | |
42 DATA = temp; | |
43 main_gui; | |
44 action = 'input_data'; | |
45 elseif isnumeric(temp), | |
46 DATA = som_data_struct(temp); | |
47 main_gui; | |
48 action = 'input_data'; | |
49 else | |
50 action = temp; | |
51 end | |
52 end | |
53 | |
54 | |
55 switch(action) | |
56 | |
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LOAD %%%%%%%%%%%%%%%%%%%%%%%%%% | |
58 case 'load_data' | |
59 loadgui3; %%% Activates load GUI | |
60 case 'workspace' | |
61 workspace; %%% Workspace selected | |
62 case 'file' | |
63 file; %%% File Selected | |
64 case 'file_select' | |
65 file_select; | |
66 case 'missing' | |
67 Handle = findobj(gcf,'Tag','Checkbox1'); | |
68 set(Handle,'Value',1); | |
69 case 'load_ok' %%% <Load OK> pushed | |
70 load_ok; | |
71 case 'input_data' %%% GUI activated with data as arg1 | |
72 input_data; %%% eg. som_gui(data) | |
73 | |
74 case 'browse' %%% Activates Browse GUI | |
75 browse; %%% Browse files or workspace variables | |
76 | |
77 case 'works_ok' %%% <OK> pushed in (workspace) browse GUI | |
78 works_ok; | |
79 | |
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
81 | |
82 | |
83 %%%%%%%%%%%%%%%%%%%%%%%% Initialization %%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
84 | |
85 case 'def_initialization' %%% Finds default initialization ... | |
86 def_initialization; %%% parameters | |
87 | |
88 case 'change_initialization' %%% Activates change (init) parameters GUI | |
89 change_initialization; | |
90 | |
91 case 'change_initialization_ok'%%% Set new init. parameters | |
92 change_initialization_ok; | |
93 | |
94 case 'change_initialization_cancel' | |
95 close(gcf); | |
96 return; | |
97 | |
98 case 'map_size' %%% Checks that 'map_size' is given in correct form | |
99 map_size; | |
100 | |
101 case 'munits' %%% Checks that 'munits' is given in correct form | |
102 munits; | |
103 | |
104 case 'init' %%% Initialize Map | |
105 init; | |
106 | |
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
108 | |
109 %%%%%%%%%%%%%%%%%%%%%%%%% Train %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
110 | |
111 | |
112 case 'def_values_others' | |
113 def_values_others; | |
114 | |
115 case 'def_values_train' | |
116 STRAIN1 = som_train_struct('algorithm',ALGORITHM,'phase','rough','data',DATA); | |
117 STRAIN2 = som_train_struct('previous',STRAIN1); | |
118 | |
119 case 'fill_fields' %%% Fill text fields in GUI | |
120 fill_fields; | |
121 | |
122 case 'def_train' %%% Train Map | |
123 def_train; | |
124 | |
125 case 'change_def' %%% Change default training parameters | |
126 change_def; %%% Activate GUI | |
127 | |
128 case 'fill_new_defaults' | |
129 fill_new_defaults; | |
130 | |
131 case 'set_batch_mask' | |
132 set_batch_mask; | |
133 | |
134 case 'set_new_parameters' | |
135 set_new_parameters; | |
136 | |
137 case 'only_finetune' %%% Train only once with finetune parameters | |
138 only_finetune; | |
139 | |
140 %%%%%%% Next function check correctnes of new training parameters. | |
141 | |
142 case 'check_rough_radini' | |
143 check_rough_radini; | |
144 case 'check_fine_radini' | |
145 check_fine_radini; | |
146 case 'check_rough_radfin' | |
147 check_rough_radfin; | |
148 case 'check_fine_radfin' | |
149 check_fine_radfin; | |
150 case 'check_rough_alphaini' | |
151 check_rough_alphaini; | |
152 case 'check_fine_alphaini' | |
153 check_fine_alphaini; | |
154 case 'check_rough_trainlen' | |
155 check_rough_trainlen; | |
156 case 'check_fine_trainlen' | |
157 check_fine_trainlen; | |
158 | |
159 | |
160 | |
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
162 | |
163 %%%%%%%%%%%%%%%%%%%%%%%%% Save Map %%%%%%%%%%%%%%%%%%%%%% | |
164 | |
165 case 'savemap' %%% Save as <.cod> file | |
166 savemap; | |
167 case 'save_workspace' %%% Save in workspace | |
168 save_workspace; | |
169 | |
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
171 | |
172 | |
173 %%%%%%%%%%%%%%%%%%%%%%% Help & Info %%%%%%%%%%%%%%%%%%%%%%% | |
174 case 'help' | |
175 web file:///share/somtoolbox/vs2/html/som_GUI.html; | |
176 case 'helpwin' | |
177 helpwin1; | |
178 case 'helpwin2' | |
179 helpwin som_gui; | |
180 case 'data_info' | |
181 data_info; %%% Info about data | |
182 case 'map_info' %%% Info about map | |
183 map_info; | |
184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
185 | |
186 %%%%%%%%%%%%%%%%%%% Other Functions %%%%%%%%%%%%%%%%%%%%%%% | |
187 | |
188 case 'preprocess' | |
189 preprocess_gui; %%%%% Call preprocess GUI | |
190 case 'visualize' | |
191 visualize; %%%%% Call visualization GUI | |
192 | |
193 case 'clear_all' %%%%% Clear all filds | |
194 clear_all; | |
195 | |
196 case 'close' | |
197 close_fig; %%%%% Close active GUI | |
198 | |
199 end | |
200 | |
201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
202 %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%% | |
203 %%%%%%%%%%%% END OF SWITCH-STATEMENT %%%%%%%%%%%%%%%%%%%%% | |
204 %%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%% | |
205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | |
213 | |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | |
220 | |
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
222 %%%%%%%%% (SUB) FUNCTIONS | |
223 | |
224 | |
225 | |
226 | |
227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
228 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
229 %%%%%%%%%%%%%%%%% LOAD SECTION STARTS %%%%%%%%%%%%%%%%%%% | |
230 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
232 | |
233 function [] = workspace() | |
234 Handle = findobj(gcbf,'Tag','Radiobutton2'); | |
235 Value = get(Handle,'Value'); | |
236 HandleTemp = findobj(gcbf,'Tag','Radiobutton1'); | |
237 if Value == 1 | |
238 set(HandleTemp,'Value',0); | |
239 HandleBar = findobj(gcbf,'Tag','PopupMenu1'); | |
240 set(HandleBar,'Enable','off'); | |
241 set(HandleBar,'Visible','off'); | |
242 Handle3 = findobj(gcbf,'Tag','StaticText3'); | |
243 set(Handle3,'Visible','off'); | |
244 Handle3 = findobj(gcbf,'Tag','Checkbox1'); | |
245 set(Handle3,'Visible','off'); | |
246 Handle3 = findobj(gcbf,'Tag','EditText3'); | |
247 set(Handle3,'Visible','off'); | |
248 Handle = findobj(gcbf,'Tag','EditText2'); | |
249 set(Handle,'String',''); | |
250 end | |
251 | |
252 | |
253 | |
254 function [] = file() | |
255 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
256 Value = get(Handle,'Value'); | |
257 HandleTemp = findobj(gcbf,'Tag','Radiobutton2'); | |
258 if Value == 1 | |
259 set(HandleTemp,'Value',0); | |
260 HandleBar = findobj(gcbf,'Tag','PopupMenu1'); | |
261 set(HandleBar,'Enable','on'); | |
262 set(HandleBar,'Visible','on'); | |
263 Handle3 = findobj(gcbf,'Tag','StaticText3'); | |
264 set(Handle3,'Visible','on'); | |
265 Handle3 = findobj(gcbf,'Tag','Checkbox1'); | |
266 set(Handle3,'Visible','on'); | |
267 Handle3 = findobj(gcbf,'Tag','EditText3'); | |
268 set(Handle3,'Visible','on'); | |
269 Handle = findobj(gcbf,'Tag','EditText1'); | |
270 set(Handle,'String',''); | |
271 end | |
272 | |
273 function [] = file_select() | |
274 Handle = findobj(gcbf,'Tag','PopupMenu1'); | |
275 temp = get(Handle,'String'); | |
276 val = get(Handle,'Value'); | |
277 Handle1 = findobj(gcbf,'Tag','Checkbox1'); | |
278 Handle2 = findobj(gcbf,'Tag','EditText3'); | |
279 if strcmp(temp{val},'dat file') | |
280 set(Handle2,'String','x'); | |
281 set(Handle1,'Enable','on'); | |
282 set(Handle2,'Enable','on'); | |
283 set(Handle1,'Visible','on'); | |
284 set(Handle2,'Visible','on'); | |
285 else | |
286 set(Handle1,'Value',0); | |
287 set(Handle1,'Enable','off'); | |
288 set(Handle2,'Enable','off'); | |
289 set(Handle1,'Visible','off'); | |
290 set(Handle2,'Visible','off'); | |
291 end | |
292 | |
293 function [] = load_ok() | |
294 global MAP DATA LOAD_DATA LOAD_NAME; | |
295 Handle1 = findobj(gcbf,'Tag','EditText1'); | |
296 Handle2 = findobj(gcbf,'Tag','EditText2'); | |
297 Name1 = get(Handle1,'String'); | |
298 Name2 = get(Handle2,'String'); | |
299 if isempty(Name1) & not(isempty(Name2)) | |
300 Handle = findobj(gcbf,'Tag','PopupMenu1') | |
301 type = get(Handle,'String'); | |
302 val = get(Handle,'Value'); | |
303 type = type{val}; | |
304 if strcmp(type,'mat file') | |
305 ltemp = 'load:::'; | |
306 ltemp = strcat(ltemp,Name2); | |
307 ltemp = strrep(ltemp,':::',' '); | |
308 evalin('base',ltemp); | |
309 DATA = evalin('base','sD'); | |
310 LOAD_DATA = evalin('base','sD.data'); | |
311 LOAD_NAME = evalin('base','sD.name'); | |
312 LOAD_NAME = strrep(LOAD_NAME,'.','_'); | |
313 load_labels = evalin('base','sD.labels'); | |
314 load_comp_names = evalin('base','sD.comp_names'); | |
315 DATA = som_data_struct(LOAD_DATA); | |
316 DATA.name = LOAD_NAME; | |
317 DATA.comp_names = load_comp_names; | |
318 DATA.labels = load_labels; | |
319 else | |
320 Handle = findobj(gcbf,'Tag','Checkbox1'); | |
321 value = get(Handle,'Value'); | |
322 if value == 0 | |
323 temp = 'som_read_data('''; | |
324 temp = strcat(temp,Name2,''');'); | |
325 else | |
326 Handle = findobj(gcbf,'Tag','EditText3'); | |
327 missing = get(Handle,'String'); | |
328 if not(isempty(missing)) | |
329 temp = 'som_read_data('''; | |
330 temp = strcat(temp,Name2,'''',',','''',missing,''');'); | |
331 else | |
332 temp = 'som_read_data('''; | |
333 temp = strcat(temp,Name2,''');'); | |
334 end | |
335 end | |
336 evalin('base',temp); | |
337 DATA = evalin('base','ans'); | |
338 name = DATA.name; | |
339 temp = findstr('/',name); | |
340 if not(isempty(temp)) | |
341 name = name(temp(end)+1:end); | |
342 end | |
343 name = strrep(name,'.','_'); | |
344 LOAD_NAME = name; | |
345 DATA.name = name; | |
346 end | |
347 elseif isempty(Name2) & not(isempty(Name1)) | |
348 LOAD_DATA = evalin('base',Name1); | |
349 if not(isstruct(LOAD_DATA)) | |
350 DATA = som_data_struct(LOAD_DATA); | |
351 LOAD_NAME = Name1; | |
352 DATA.name = Name1; | |
353 else | |
354 DATA = LOAD_DATA; | |
355 name = DATA.name; | |
356 temp = findstr('/',name); | |
357 if not(isempty(temp)) | |
358 name = name(temp(end)+1:end); | |
359 end | |
360 name = strrep(name,'.','_'); | |
361 LOAD_NAME = name; | |
362 DATA.name = name; | |
363 end | |
364 else | |
365 errmsg = {'Give name of data before loading'}; | |
366 errordlg(errmsg,'Empty data name!'); | |
367 return; | |
368 end | |
369 close(gcbf); | |
370 if not(isempty(MAP)) | |
371 clear MAP; | |
372 global MAP; | |
373 str1 = 'Map: <empty>'; | |
374 str2 = 'Train'; | |
375 Handle = findobj(gcf,'Tag','StaticText3'); | |
376 set(Handle,'String',str1); | |
377 Handle = findobj(gcf,'Tag','StaticText8'); | |
378 set(Handle,'String',str2); | |
379 end | |
380 temp = 'Data:'; | |
381 temp = strcat(temp,' <',LOAD_NAME,'>'); | |
382 Handle = findobj(gcf,'Tag','StaticText4'); | |
383 set(Handle,'String',temp); | |
384 som_gui('def_initialization'); | |
385 Handle = findobj(gcf,'Tag','Pushbutton2'); | |
386 set(Handle,'Enable','off'); | |
387 Handle = findobj(gcf,'Tag','Pushbutton4'); | |
388 set(Handle,'Enable','on'); | |
389 Handle = findobj(gcf,'Tag','Pushbutton9'); | |
390 set(Handle,'Enable','on'); | |
391 Handle = findobj(gcf,'Tag','Subuimenu2'); | |
392 set(Handle,'Enable','on'); | |
393 Handle = findobj(gcf,'Tag','&Help/InfoHelp windowuimenu1'); | |
394 set(Handle,'Enable','on'); | |
395 Handle = findobj(gcf,'Tag','&Init&Trainuimenu1'); | |
396 set(Handle,'Enable','on'); | |
397 Handle = findobj(gcf,'Tag','&Init&TrainInitialize1'); | |
398 set(Handle,'Enable','on'); | |
399 Handle = findobj(gcf,'Tag','Subuimenu1'); | |
400 set(Handle,'Enable','off'); %%%%%%???????? | |
401 Handle = findobj(gcf,'Tag','StaticText10'); | |
402 set(Handle,'String','Status <data loaded>'); | |
403 | |
404 | |
405 | |
406 function [] = input_data() | |
407 global DATA; | |
408 name = DATA.name; | |
409 newname = strrep(name,'.','_'); | |
410 DATA.name = newname; | |
411 temp = strcat('Data: <',newname,'>'); | |
412 Handle = findobj(gcf,'Tag','StaticText4'); | |
413 set(Handle,'String',temp); | |
414 som_gui('def_initialization'); | |
415 Handle = findobj(gcf,'Tag','Pushbutton2'); | |
416 set(Handle,'Enable','off'); | |
417 Handle = findobj(gcf,'Tag','Pushbutton4'); | |
418 set(Handle,'Enable','on'); | |
419 Handle = findobj(gcf,'Tag','Pushbutton9'); | |
420 set(Handle,'Enable','on'); | |
421 Handle = findobj(gcf,'Tag','Subuimenu2'); | |
422 set(Handle,'Enable','on'); | |
423 Handle = findobj(gcf,'Tag','&Help/InfoHelp windowuimenu1'); | |
424 set(Handle,'Enable','on'); | |
425 Handle = findobj(gcf,'Tag','&Init&Trainuimenu1'); | |
426 set(Handle,'Enable','on'); | |
427 Handle = findobj(gcf,'Tag','&Init&TrainInitialize1'); | |
428 set(Handle,'Enable','on'); | |
429 Handle = findobj(gcf,'Tag','Subuimenu1'); | |
430 set(Handle,'Enable','off'); %%%%%%???????? | |
431 Handle = findobj(gcf,'Tag','StaticText10'); | |
432 set(Handle,'String','Status <data loaded>'); | |
433 | |
434 | |
435 function [] = browse() | |
436 global HANDLE2; | |
437 HandleWorkspace = findobj(gcbf,'Tag','Radiobutton2'); | |
438 HandleFile = findobj(gcbf,'Tag','Radiobutton1'); | |
439 WorkspaceVal = get(HandleWorkspace,'Value'); | |
440 FileVal = get(HandleFile,'Value'); | |
441 if FileVal == 1 | |
442 Handle = findobj(gcbf,'Tag','PopupMenu1'); | |
443 str = get(Handle,'String'); | |
444 value = get(Handle,'Value'); | |
445 str = str{value}; | |
446 if strcmp(str,'mat file') | |
447 filtter = '*.mat'; | |
448 else | |
449 filtter = '*.dat*'; | |
450 end | |
451 [filename pathname] = uigetfile(filtter,'Load file.'); | |
452 temp = strcat(pathname,filename); | |
453 Handle = findobj(gcbf,'Tag','EditText2'); | |
454 set(Handle,'String',temp); | |
455 elseif WorkspaceVal == 1 | |
456 HANDLE2 = gcf; | |
457 works; | |
458 temp = evalin('base','who'); | |
459 index2 = 1; | |
460 names = ''; | |
461 for index = 1:length(temp) | |
462 if isnumeric(evalin('base',temp{index})) | |
463 test = size(evalin('base',temp{index})); | |
464 if test(1) ~= 1 & test(2) ~= 1 | |
465 names{index2} = temp{index}; | |
466 index2 = index2 + 1; | |
467 end | |
468 end | |
469 end | |
470 for index = 1:length(temp) | |
471 variable = evalin('base',temp{index}); | |
472 if isstruct(variable) | |
473 fnames = fieldnames(variable); | |
474 if size(fnames,1) == 6 & strcmp(fnames(1),'type') & strcmp(variable.type,'som_data') | |
475 names{index2} = temp{index}; | |
476 index2 = index2 + 1; | |
477 end | |
478 end | |
479 end | |
480 Handle = findobj(gcf,'Tag','Listbox1'); | |
481 %%%%%% if is empty string#%%% | |
482 set(Handle,'String',names); | |
483 else | |
484 errmsg = 'Select browse type: Workspace or file.'; | |
485 errordlg(errmsg,'Browse error!'); | |
486 return; | |
487 end | |
488 | |
489 | |
490 function [] = works_ok() | |
491 global HANDLE2; | |
492 Handle = findobj(gcbf,'Tag','Listbox1'); | |
493 temp = get(Handle,'String'); | |
494 val = get(Handle,'Value'); | |
495 data = temp{val}; | |
496 Handle = findobj(HANDLE2,'Tag','EditText1'); | |
497 set(Handle,'String',data); | |
498 close; | |
499 | |
500 | |
501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
502 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
503 %%%%%%%%%%%%%%%%% END OF LOAD SECTION %%%%%%%%%%%%%%%%%%% | |
504 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
506 | |
507 | |
508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
509 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
510 %%%%%%%%%%%%%%%%% START OF INITIALIZATION %%%%%%%%%%%%%%%%%%% | |
511 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
513 | |
514 function [] = def_initialization() | |
515 global DATA STOPOLINIT INIT_TYPE; | |
516 sTopol = som_topol_struct('data',DATA); | |
517 Handle = findobj(gcf,'Tag','StaticText5'); | |
518 temp = num2str(sTopol.msize); | |
519 temp = strcat('map size:',' [',temp,']'); | |
520 set(Handle,'String',temp); | |
521 Handle = findobj(gcf,'Tag','StaticText6'); | |
522 set(Handle,'String','type: linear'); | |
523 Handle = findobj(gcf,'Tag','StaticText20'); | |
524 temp = strcat('lattice:',sTopol.lattice); | |
525 set(Handle,'String',temp); | |
526 Handle = findobj(gcf,'Tag','StaticText21'); | |
527 temp = strcat('shape:',sTopol.shape); | |
528 set(Handle,'String',temp); | |
529 STOPOLINIT = sTopol; | |
530 INIT_TYPE = 'linear'; | |
531 | |
532 function [] = change_initialization() | |
533 global INIT_TYPE STOPOLINIT; | |
534 initialization2; | |
535 Handle = findobj(gcf,'Tag','PopupMenu1'); | |
536 temp = get(Handle,'String'); | |
537 val = loop(temp,INIT_TYPE); | |
538 set(Handle,'Value',val); | |
539 Handle = findobj(gcf,'Tag','PopupMenu2'); | |
540 temp = get(Handle,'String'); | |
541 val = loop(temp,STOPOLINIT.lattice); | |
542 set(Handle,'Value',val); | |
543 Handle = findobj(gcf,'Tag','PopupMenu3'); | |
544 temp = get(Handle,'String'); | |
545 val = loop(temp,STOPOLINIT.shape); | |
546 set(Handle,'Value',val); | |
547 Handle = findobj(gcf,'Tag','EditText1'); | |
548 temp = num2str(STOPOLINIT.msize); | |
549 msize = strcat('[',temp,']'); | |
550 set(Handle,'String',msize); | |
551 | |
552 function [] = change_initialization_ok() | |
553 Handle = findobj(gcbf,'Tag','PopupMenu1'); | |
554 temp = get(Handle,'String'); | |
555 val = get(Handle,'Value'); | |
556 INIT_TYPE = temp{val}; | |
557 Handle = findobj(gcbf,'Tag','PopupMenu2'); | |
558 temp = get(Handle,'String'); | |
559 val = get(Handle,'Value'); | |
560 lattice = temp{val}; | |
561 Handle = findobj(gcbf,'Tag','PopupMenu3'); | |
562 temp = get(Handle,'String'); | |
563 val = get(Handle,'Value'); | |
564 shape = temp{val}; | |
565 Handle = findobj(gcbf,'Tag','EditText1'); | |
566 temp = get(Handle,'String'); | |
567 msize = str2num(temp); | |
568 STOPOLINIT = som_set('som_topol','msize',msize,'lattice',lattice,'shape',shape); | |
569 close(gcf); | |
570 Handle = findobj(gcf,'Tag','StaticText5'); | |
571 temp = num2str(STOPOLINIT.msize); | |
572 temp = strcat('map size:',' [',temp,']'); | |
573 set(Handle,'String',temp); | |
574 Handle = findobj(gcf,'Tag','StaticText6'); | |
575 temp = strcat('type:',INIT_TYPE); | |
576 set(Handle,'String',temp); | |
577 Handle = findobj(gcf,'Tag','StaticText20'); | |
578 temp = strcat('lattice:',STOPOLINIT.lattice); | |
579 set(Handle,'String',temp); | |
580 Handle = findobj(gcf,'Tag','StaticText21'); | |
581 temp = strcat('shape:',STOPOLINIT.shape); | |
582 set(Handle,'String',temp); | |
583 | |
584 | |
585 function [] = def_values_others() | |
586 global SOTHERS; | |
587 Handle = findobj(gcf,'Tag','StaticText19'); | |
588 temp = strcat('tracking:',SOTHERS.tracking); | |
589 set(Handle,'String',temp); | |
590 Handle = findobj(gcf,'Tag','StaticText12'); | |
591 temp = strcat('order:',SOTHERS.oder); | |
592 set(Handle,'String',temp); | |
593 Handle = findobj(gcf,'Tag','StaticText14'); | |
594 temp = strcat('length_type:',SOTHERS.length_type); | |
595 set(Handle,'String',temp); | |
596 | |
597 | |
598 | |
599 function [] = fill_fields() | |
600 global STRAIN1 STRAIN2 ALGORITHM | |
601 | |
602 neigh = STRAIN1.neigh; | |
603 mask = STRAIN1.mask; | |
604 rad_ini1 = STRAIN1.radius_ini; | |
605 rad_ini2 = STRAIN2.radius_ini; | |
606 rad_fin1 = STRAIN1.radius_fin; | |
607 rad_fin2 = STRAIN2.radius_fin; | |
608 trainlen1 = num2str(STRAIN1.trainlen); | |
609 trainlen2 = num2str(STRAIN2.trainlen); | |
610 alpha_ini1 = num2str(STRAIN1.alpha_ini); | |
611 alpha_ini2 = num2str(STRAIN2.alpha_ini); | |
612 if strcmp(ALGORITHM,'seq') | |
613 alpha_type = STRAIN1.alpha_type; %%% only in sequential | |
614 Handle = findobj(gcf,'Tag','StaticText28'); | |
615 temp = strcat('alpha type:',alpha_type); | |
616 set(Handle,'String',temp); | |
617 end | |
618 Handle = findobj(gcf,'Tag','StaticText11'); | |
619 temp = strcat('neigh: ',neigh); | |
620 set(Handle,'String',temp); | |
621 Handle = findobj(gcf,'Tag','StaticText22'); | |
622 temp = num2str(rad_fin1); | |
623 temp = strcat('radius final:',temp); | |
624 set(Handle,'String',temp); | |
625 Handle = findobj(gcf,'Tag','StaticText25'); | |
626 temp = num2str(rad_fin2); | |
627 temp = strcat('radius final:',temp); | |
628 set(Handle,'String',temp); | |
629 Handle = findobj(gcf,'Tag','StaticText11'); | |
630 temp = strcat('neigh: ',neigh); | |
631 set(Handle,'String',temp); | |
632 Handle = findobj(gcf,'Tag','StaticText17'); | |
633 temp = num2str(rad_ini1); | |
634 temp = strcat('radius initial:',temp); | |
635 set(Handle,'String',temp); | |
636 Handle = findobj(gcf,'Tag','StaticText24'); | |
637 temp = num2str(rad_ini2); | |
638 temp = strcat('radius initial:',temp); | |
639 set(Handle,'String',temp); | |
640 Handle = findobj(gcf,'Tag','StaticText16'); | |
641 temp = num2str(trainlen1); | |
642 temp = strcat('training length:',temp); | |
643 set(Handle,'String',temp); | |
644 Handle = findobj(gcf,'Tag','StaticText23'); | |
645 temp = num2str(trainlen2); | |
646 temp = strcat('training length:',temp); | |
647 set(Handle,'String',temp); | |
648 Handle = findobj(gcf,'Tag','StaticText26'); | |
649 temp = strcat('alpha initial:',alpha_ini1); | |
650 set(Handle,'String',temp); | |
651 Handle = findobj(gcf,'Tag','StaticText27'); | |
652 temp = strcat('alpha initial:',alpha_ini2); | |
653 set(Handle,'String',temp); | |
654 | |
655 | |
656 function [] = init(); | |
657 global INIT_TYPE MAP NEWMAP ALGORITHM SOTHERS DATA STOPOLINIT; | |
658 if strcmp(INIT_TYPE,'random') | |
659 MAP = som_randinit(DATA,STOPOLINIT); | |
660 else | |
661 MAP = som_lininit(DATA,STOPOLINIT); | |
662 end | |
663 NEWMAP = MAP; | |
664 temp = 'Map:'; | |
665 temp = strcat(temp,' <',MAP.name,'>'); | |
666 Handle = findobj(gcbf,'Tag','StaticText3'); | |
667 set(Handle,'String',temp); | |
668 Handle = findobj(gcbf,'Tag','StaticText10'); | |
669 set(Handle,'String','Status <map initialized>'); | |
670 ALGORITHM = 'batch'; | |
671 Handle = findobj(gcbf,'Tag','Pushbutton4'); | |
672 set(Handle,'Enable','off'); | |
673 Handle = findobj(gcbf,'Tag','Pushbutton6'); | |
674 set(Handle,'Enable','on'); | |
675 Handle = findobj(gcbf,'Tag','Pushbutton5'); | |
676 set(Handle,'Enable','on'); | |
677 SOTHERS.tracking = '1'; | |
678 SOTHERS.length_type = 'epochs'; | |
679 SOTHERS.oder = 'random'; | |
680 som_gui('def_values_topol'); | |
681 som_gui('def_values_train'); | |
682 som_gui('def_values_others'); | |
683 som_gui('fill_fields'); | |
684 Handle = findobj(gcbf,'Tag','Pushbutton4'); | |
685 set(Handle,'Enable','off'); | |
686 Handle = findobj(gcbf,'Tag','Pushbutton9'); | |
687 set(Handle,'Enable','off'); | |
688 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
689 set(Handle,'Enable','on'); | |
690 Handle = findobj(gcbf,'Tag','&Init&TrainChange initialization valuesuimenu1'); | |
691 set(Handle,'Enable','on'); | |
692 Handle = findobj(gcbf,'Tag','&Init&TrainTrain1'); | |
693 set(Handle,'Enable','on'); | |
694 Handle = findobj(gcbf,'Tag','&Help/InfoData infouimenu1'); | |
695 set(Handle,'Enable','on'); | |
696 Handle = findobj(gcbf,'Tag','Subuimenu2'); | |
697 set(Handle,'Enable','off'); | |
698 Handle = findobj(gcbf,'Tag','&Init&Trainuimenu1'); | |
699 set(Handle,'Enable','off'); | |
700 Handle = findobj(gcbf,'Tag','&Init&TrainInitialize1'); | |
701 set(Handle,'Enable','off'); %%%%%%%%%%%?????????? | |
702 Handle = findobj(gcbf,'Tag','StaticText9'); | |
703 set(Handle,'String','training type: batch'); | |
704 | |
705 | |
706 | |
707 function [] = set_batch_mask() | |
708 Handle = findobj(gcbf,'Tag','Listbox2'); | |
709 temp = get(Handle,'String'); | |
710 mask = str2num(temp); | |
711 Handle = findobj(gcbf,'Tag','Listbox1'); | |
712 replace = get(Handle,'Value'); | |
713 Handle = findobj(gcbf,'Tag','EditText2'); | |
714 temp = get(Handle,'String'); | |
715 value = str2num(temp); | |
716 if not(isempty(value)) | |
717 mask(replace) = value; | |
718 Handle = findobj(gcbf,'Tag','Listbox2'); | |
719 temp = num2str(mask); | |
720 set(Handle,'String',temp); | |
721 end | |
722 | |
723 function [] = munits() | |
724 global DATA STOPOLINIT; | |
725 msgs = {'Correct map units is number';'Correct map units is number'}; | |
726 [msgs_nro, value] = check_ok('EditText2'); | |
727 if msgs_nro > 0 | |
728 errordlg({msgs{msgs_nro}},'Incorrect map units!') | |
729 return; | |
730 end | |
731 STOPOLINIT = som_topol_struct('munits',value,'data',DATA); | |
732 Handle = findobj(gcbf,'Tag','EditText1'); | |
733 temp = num2str(STOPOLINIT.msize); | |
734 msize = strcat('[',temp,']'); | |
735 set(Handle,'String',msize); | |
736 | |
737 function [] = map_size() | |
738 global STOPOLINIT; | |
739 msgs = {'Map size must be in form [x y]';... | |
740 'Map size must be in form [x y]'}; | |
741 [msgs_nro, value, Handle] = msize_ok('EditText1'); | |
742 if msgs_nro > 0 | |
743 errordlg({msgs{msgs_nro}},'Incorrect map size!'); | |
744 temp = num2str(STOPOLINIT.msize); | |
745 temp = strcat('[',temp,']'); | |
746 set(Handle,'String',temp); | |
747 return; | |
748 end | |
749 STOPOLINIT.msize = value; | |
750 Handle = findobj(gcbf,'Tag','EditText2'); | |
751 set(Handle,'String',''); | |
752 | |
753 | |
754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
755 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
756 %%%%%%%%%%%%%%%%% END OF INITIALIZATION %%%%%%%%%%%%%%%%%%% | |
757 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
759 | |
760 | |
761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
762 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
763 %%%%%%%%%%%%%%%%% START OF TRAINING %%%%%%%%%%%%%%%%%%% | |
764 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
766 | |
767 | |
768 function [] = def_train() | |
769 global SOTHERS ALGORITHM MAP NEWST DATA STRAIN1 STRAIN2 MAPSAVED; | |
770 tlen_type = SOTHERS.length_type; | |
771 sample_order = SOTHERS.oder; | |
772 tracking = SOTHERS.tracking; | |
773 test = str2num(tracking); | |
774 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
775 tempval = get(Handle,'Value'); | |
776 if strcmp(ALGORITHM,'seq') | |
777 if tempval ~= 1 | |
778 [MAP NEWST] = som_seqtrain(MAP,DATA,'train',STRAIN1,tlen_type,sample_order); | |
779 end | |
780 if test > 1 | |
781 figure; | |
782 set(gcf,'Name',MAP.name); | |
783 set(gcf,'NumberTitle','off'); | |
784 end | |
785 [NEWMAP NEWST] = som_seqtrain(MAP,DATA,'train',STRAIN2,'tracking',test,tlen_type,sample_order); | |
786 else | |
787 if tempval ~= 1 | |
788 [MAP NEWST] = som_batchtrain(MAP,DATA,'train',STRAIN1); | |
789 end | |
790 if test > 1 | |
791 figure; | |
792 set(gcf,'Name',MAP.name); | |
793 set(gcf,'NumberTitle','off'); | |
794 end | |
795 [NEWMAP NEWST] = som_batchtrain(MAP,DATA,'train',STRAIN2,'tracking',test); | |
796 end | |
797 MAP = NEWMAP; | |
798 clear MAPSAVED; | |
799 Handle = findobj(gcbf,'Tag','StaticText10'); | |
800 set(Handle,'String','Status <map trained>'); | |
801 Handle = findobj(gcbf,'Tag','Load/SaveSubuimenu1'); | |
802 set(Handle,'Enable','on'); | |
803 Handle = findobj(gcbf,'Tag','Load/SaveSave mapuimenu1'); | |
804 set(Handle,'Enable','on'); | |
805 Handle = findobj(gcbf,'Tag','&Load/SaveSave mapSave in workspaceuimenu1'); | |
806 set(Handle,'Enable','on'); | |
807 Handle = findobj(gcbf,'Tag','&ToolsSubuimenu1'); | |
808 set(Handle,'Enable','on'); | |
809 Handle = findobj(gcbf,'Tag','&Init&TrainChange initialization valuesuimenu1'); | |
810 set(Handle,'Enable','off'); | |
811 Handle = findobj(gcbf,'Tag','&Init&TrainTrain1'); | |
812 set(Handle,'Enable','off'); | |
813 | |
814 | |
815 function [] = change_def() | |
816 global ALGORITHM STRAIN1 DATA; | |
817 | |
818 ButtonName = questdlg('Select training type!',... | |
819 'Change values.',... | |
820 'Batch','Sequential','Cancel',... | |
821 'Batch'); | |
822 if strcmp(ButtonName,'Sequential') | |
823 Handle = findobj(gcbf,'Visible','off'); | |
824 set(Handle,'Visible','on'); | |
825 ALGORITHM = 'seq'; | |
826 Handle = findobj(gcf,'Tag','StaticText9'); | |
827 set(Handle,'String','training type: sequential'); | |
828 new_para2_2; | |
829 Handle = findobj(gcf,'Tag','StaticText1'); | |
830 set(Handle,'String','Change parameters for sequential training'); | |
831 Handle = findobj(gcf,'Enable','off'); | |
832 set(Handle,'Enable','on'); | |
833 Handle = findobj(gcf,'Visible','off'); | |
834 set(Handle,'Visible','on'); | |
835 elseif strcmp(ButtonName,'Batch') | |
836 ALGORITHM = 'batch'; | |
837 Handle = findobj(gcbf,'Tag','StaticText26'); | |
838 set(Handle,'Visible','off'); | |
839 Handle = findobj(gcbf,'Tag','StaticText27'); | |
840 set(Handle,'Visible','off'); | |
841 Handle = findobj(gcf,'Tag','StaticText9'); | |
842 set(Handle,'String','training type: batch'); | |
843 Handle = findobj(gcf,'Tag','StaticText12'); | |
844 set(Handle,'Visible','off'); | |
845 Handle = findobj(gcf,'Tag','StaticText28'); | |
846 set(Handle,'Visible','off'); | |
847 Handle = findobj(gcf,'Tag','StaticText14'); | |
848 set(Handle,'Visible','off'); | |
849 new_para2_2; | |
850 Handle = findobj(gcf,'Tag','StaticText1'); | |
851 set(Handle,'String','Change parameters for batch training'); | |
852 Handle = findobj(gcf,'Tag','PopupMenu3'); | |
853 set(Handle,'Enable','off'); | |
854 set(Handle,'Visible','off'); | |
855 Handle = findobj(gcf,'Tag','PopupMenu4'); | |
856 set(Handle,'Enable','off'); | |
857 set(Handle,'Visible','off'); | |
858 Handle = findobj(gcf,'Tag','PopupMenu5'); | |
859 set(Handle,'Enable','off'); | |
860 set(Handle,'Visible','off'); | |
861 Handle = findobj(gcf,'Tag','StaticText17'); | |
862 set(Handle,'Visible','off'); | |
863 Handle = findobj(gcf,'Tag','StaticText18'); | |
864 set(Handle,'Visible','off'); | |
865 Handle = findobj(gcf,'Tag','StaticText19'); | |
866 set(Handle,'Visible','off'); | |
867 Handle = findobj(gcf,'Tag','StaticText13'); | |
868 set(Handle,'Visible','off'); | |
869 Handle = findobj(gcf,'Tag','StaticText14'); | |
870 set(Handle,'Visible','off'); | |
871 Handle = findobj(gcf,'Tag','EditText6'); | |
872 set(Handle,'Visible','off'); | |
873 set(Handle,'Enable','off'); | |
874 Handle = findobj(gcf,'Tag','EditText10'); | |
875 set(Handle,'Visible','off'); | |
876 set(Handle,'Enable','off'); | |
877 else | |
878 return; | |
879 end | |
880 som_gui('def_values_train'); | |
881 mask = STRAIN1.mask; | |
882 Handle = findobj(gcf,'Tag','Listbox1'); | |
883 set(Handle,'String',DATA.comp_names); | |
884 som_gui('fill_new_defaults'); | |
885 | |
886 | |
887 function [] = fill_new_defaults() | |
888 global STRAIN1 STRAIN2 SOTHERS ALGORITHM; | |
889 | |
890 Handle = findobj(gcf,'Tag','EditText4'); | |
891 temp = num2str(STRAIN1.radius_ini); | |
892 set(Handle,'String',temp); | |
893 Handle = findobj(gcf,'Tag','EditText8'); | |
894 temp = num2str(STRAIN2.radius_ini); | |
895 set(Handle,'String',temp); | |
896 Handle = findobj(gcf,'Tag','EditText5'); | |
897 temp = num2str(STRAIN1.radius_fin); | |
898 set(Handle,'String',temp); | |
899 Handle = findobj(gcf,'Tag','EditText9'); | |
900 temp = num2str(STRAIN2.radius_fin); | |
901 set(Handle,'String',temp); | |
902 Handle = findobj(gcf,'Tag','EditText6'); | |
903 temp = num2str(STRAIN1.alpha_ini); | |
904 set(Handle,'String',temp); | |
905 Handle = findobj(gcf,'Tag','EditText10'); | |
906 temp = num2str(STRAIN2.alpha_ini); | |
907 set(Handle,'String',temp); | |
908 Handle = findobj(gcf,'Tag','EditText7'); | |
909 temp = num2str(STRAIN1.trainlen); | |
910 set(Handle,'String',temp); | |
911 Handle = findobj(gcf,'Tag','EditText11'); | |
912 temp = num2str(STRAIN2.trainlen); | |
913 set(Handle,'String',temp); | |
914 Handle = findobj(gcf,'Tag','Listbox2'); | |
915 temp = num2str(STRAIN1.mask'); | |
916 set(Handle,'String',temp); | |
917 Handle = findobj(gcf,'Tag','PopupMenu2'); | |
918 string = get(Handle,'String'); | |
919 val = loop(string,SOTHERS.tracking); | |
920 set(Handle,'Value',val); | |
921 Handle = findobj(gcf,'Tag','PopupMenu1'); | |
922 string = get(Handle,'String'); | |
923 val = loop(string,STRAIN1.neigh); | |
924 set(Handle,'Value',val); | |
925 if strcmp(ALGORITHM,'seq') | |
926 Handle = findobj(gcf,'Tag','PopupMenu3'); | |
927 string = get(Handle,'String'); | |
928 val = loop(string,SOTHERS.length_type); | |
929 set(Handle,'Value',val); | |
930 Handle = findobj(gcf,'Tag','PopupMenu4'); | |
931 string = get(Handle,'String'); | |
932 val = loop(string,SOTHERS.oder); | |
933 set(Handle,'Value',val); | |
934 Handle = findobj(gcf,'Tag','PopupMenu5'); | |
935 string = get(Handle,'String'); | |
936 val = loop(string,STRAIN1.alpha_type); | |
937 set(Handle,'Value',val); | |
938 end | |
939 | |
940 | |
941 | |
942 function [] = set_new_parameters() | |
943 global STRAIN1 STRAIN2 ALGORITHM SOTHERS; | |
944 | |
945 Handle = findobj(gcbf,'Tag','Listbox2'); | |
946 temp = get(Handle,'String'); | |
947 mask = str2num(temp); %%%%%%%%%%%%% Do somthing | |
948 mask = mask'; | |
949 Handle = findobj(gcbf,'Tag','PopupMenu1'); | |
950 temp = get(Handle,'String'); | |
951 val = get(Handle,'Value'); | |
952 neigh = temp{val}; | |
953 Handle = findobj(gcbf,'Tag','PopupMenu2'); | |
954 temp = get(Handle,'String'); | |
955 val = get(Handle,'Value'); | |
956 SOTHERS.tracking = temp{val}; %%%%% finetune phase! | |
957 Handle = findobj(gcbf,'Tag','EditText4'); | |
958 temp = get(Handle,'String'); | |
959 rad_ini1 = str2num(temp); | |
960 Handle = findobj(gcbf,'Tag','EditText8'); | |
961 temp = get(Handle,'String'); | |
962 rad_ini2 = str2num(temp); | |
963 Handle = findobj(gcbf,'Tag','EditText5'); | |
964 temp = get(Handle,'String'); | |
965 rad_fin1 = str2num(temp); | |
966 Handle = findobj(gcbf,'Tag','EditText9'); | |
967 temp = get(Handle,'String'); | |
968 rad_fin2 = str2num(temp); | |
969 Handle = findobj(gcbf,'Tag','EditText6'); | |
970 temp = get(Handle,'String'); | |
971 alpha_ini1 = str2num(temp); | |
972 Handle = findobj(gcbf,'Tag','EditText10'); | |
973 temp = get(Handle,'String'); | |
974 alpha_ini2 = str2num(temp); | |
975 Handle = findobj(gcbf,'Tag','EditText7'); | |
976 temp = get(Handle,'String'); | |
977 train_length1 = str2num(temp); | |
978 Handle = findobj(gcbf,'Tag','EditText11'); | |
979 temp = get(Handle,'String'); | |
980 train_length2 = str2num(temp); | |
981 if strcmp(ALGORITHM,'seq') | |
982 Handle = findobj(gcbf,'Tag','PopupMenu3'); | |
983 temp = get(Handle,'String'); | |
984 val = get(Handle,'Value'); | |
985 SOTHERS.length_type = temp{val}; | |
986 Handle = findobj(gcbf,'Tag','PopupMenu4'); | |
987 temp = get(Handle,'String'); | |
988 val = get(Handle,'Value'); | |
989 SOTHERS.oder= temp{val}; | |
990 Handle = findobj(gcbf,'Tag','PopupMenu5'); | |
991 temp = get(Handle,'String'); | |
992 val = get(Handle,'Value'); | |
993 alpha_type = temp{val}; | |
994 else | |
995 alpha_type = 'inv'; | |
996 end | |
997 STRAIN1.neigh = neigh; | |
998 STRAIN2.neigh = neigh; | |
999 STRAIN1.mask = mask; | |
1000 STRAIN2.mask = mask; | |
1001 STRAIN1.radius_ini = rad_ini1; | |
1002 STRAIN2.radius_ini = rad_ini2; | |
1003 STRAIN1.radius_fin = rad_fin1; | |
1004 STRAIN2.radius_fin = rad_fin2; | |
1005 STRAIN1.alpha_ini = alpha_ini1; | |
1006 STRAIN2.alpha_ini = alpha_ini2; | |
1007 STRAIN1.alpha_type = alpha_type; | |
1008 STRAIN2.alpha_type = alpha_type; | |
1009 STRAIN1.trainlen = train_length1; | |
1010 STRAIN2.trainlen = train_length2; | |
1011 close(gcbf); | |
1012 som_gui('fill_fields'); | |
1013 som_gui('def_values_others'); | |
1014 | |
1015 function [] = only_finetune() | |
1016 | |
1017 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
1018 test = get(Handle,'Value'); | |
1019 if test == 1 | |
1020 Handle = findobj(gcbf,'Tag','StaticText16'); | |
1021 set(Handle,'Enable','off'); | |
1022 Handle = findobj(gcbf,'Tag','StaticText17'); | |
1023 set(Handle,'Enable','off'); | |
1024 Handle = findobj(gcbf,'Tag','StaticText22'); | |
1025 set(Handle,'Enable','off'); | |
1026 Handle = findobj(gcbf,'Tag','StaticText26'); | |
1027 set(Handle,'Enable','off'); | |
1028 else | |
1029 Handle = findobj(gcbf,'Tag','StaticText16'); | |
1030 set(Handle,'Enable','on'); | |
1031 Handle = findobj(gcbf,'Tag','StaticText17'); | |
1032 set(Handle,'Enable','on'); | |
1033 Handle = findobj(gcbf,'Tag','StaticText22'); | |
1034 set(Handle,'Enable','on'); | |
1035 Handle = findobj(gcbf,'Tag','StaticText26'); | |
1036 set(Handle,'Enable','on'); | |
1037 end | |
1038 | |
1039 | |
1040 function [] = check_rough_radini() | |
1041 global STRAIN1; | |
1042 msgs = {'Initial radius must be number!';... | |
1043 'Initial radius must be single valued number!'}; | |
1044 [msgs_nro, value, Handle] = check_ok('EditText4'); | |
1045 if msgs_nro > 0 | |
1046 errordlg({msgs{msgs_nro}},'Incorrect initial radius!') | |
1047 temp = num2str(STRAIN1.radius_ini); | |
1048 set(Handle,'String',temp); | |
1049 return; | |
1050 end | |
1051 | |
1052 | |
1053 function [] = check_fine_radini() | |
1054 global STRAIN2; | |
1055 msgs = {'Initial radius must be number!';... | |
1056 'Initial radius must be single valued number!'}; | |
1057 [msgs_nro, value, Handle] = check_ok('EditText8'); | |
1058 if msgs_nro > 0 | |
1059 errordlg({msgs{msgs_nro}},'Incorrect initial radius!') | |
1060 temp = num2str(STRAIN2.radius_ini); | |
1061 set(Handle,'String',temp); | |
1062 return; | |
1063 end | |
1064 | |
1065 function [] = check_rough_radfin() | |
1066 global STRAIN1; | |
1067 msgs = {'Final radius must be number!';... | |
1068 'Final radius must be single valued number!'}; | |
1069 [msgs_nro, value, Handle] = check_ok('EditText5'); | |
1070 if msgs_nro > 0 | |
1071 errordlg({msgs{msgs_nro}},'Incorrect final radius!') | |
1072 temp = num2str(STRAIN1.radius_fin); | |
1073 set(Handle,'String',temp); | |
1074 return; | |
1075 end | |
1076 | |
1077 function [] = check_fine_radfin() | |
1078 global STRAIN2; | |
1079 msgs = {'Final radius must be number!';... | |
1080 'Final radius must be single valued number!'}; | |
1081 [msgs_nro, value, Handle] = check_ok('EditText9'); | |
1082 if msgs_nro > 0 | |
1083 errordlg({msgs{msgs_nro}},'Incorrect final radius!') | |
1084 temp = num2str(STRAIN2.radius_fin); | |
1085 set(Handle,'String',temp); | |
1086 return; | |
1087 end | |
1088 | |
1089 function [] = check_rough_alphaini() | |
1090 global STRAIN1; | |
1091 msgs = {'Alpha initial must be number!';... | |
1092 'Alpha initial must be single valued number!'}; | |
1093 [msgs_nro, value, Handle] = check_ok('EditText6'); | |
1094 if msgs_nro > 0 | |
1095 errordlg({msgs{msgs_nro}},'Incorrect initial alpha!') | |
1096 temp = num2str(STRAIN1.alpha_ini); | |
1097 set(Handle,'String',temp); | |
1098 return; | |
1099 end | |
1100 | |
1101 function [] = check_fine_alphaini() | |
1102 global STRAIN2; | |
1103 msgs = {'Alpha initial must be number!';... | |
1104 'Alpha initial must be single valued number!'}; | |
1105 [msgs_nro, value, Handle] = check_ok('EditText10'); | |
1106 if msgs_nro > 0 | |
1107 errordlg({msgs{msgs_nro}},'Incorrect initial alpha!') | |
1108 temp = num2str(STRAIN2.alpha_ini); | |
1109 set(Handle,'String',temp); | |
1110 return; | |
1111 end | |
1112 | |
1113 function [] = check_rough_trainlen() | |
1114 global STRAIN1; | |
1115 msgs = {'Training length must be number!';... | |
1116 'Training length must be single valued number!'}; | |
1117 [msgs_nro, value, Handle] = check_ok('EditText7'); | |
1118 if msgs_nro > 0 | |
1119 errordlg({msgs{msgs_nro}},'Incorrect training length!') | |
1120 temp = num2str(STRAIN1.trainlen); | |
1121 set(Handle,'String',temp); | |
1122 return; | |
1123 end | |
1124 | |
1125 function [] = check_fine_trainlen() | |
1126 global STRAIN2; | |
1127 | |
1128 msgs = {'Training length must be number!';... | |
1129 'Training length must be single valued number!'}; | |
1130 [msgs_nro, value, Handle] = check_ok('EditText11'); | |
1131 if msgs_nro > 0 | |
1132 errordlg({msgs{msgs_nro}},'Incorrect training length!') | |
1133 temp = num2str(STRAIN2.trainlen); | |
1134 set(Handle,'String',temp); | |
1135 return; | |
1136 end | |
1137 | |
1138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1139 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1140 %%%%%%%%%%%%%%%%% END OF TRAINING %%%%%%%%%%%%%%%%%%% | |
1141 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1143 | |
1144 | |
1145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1146 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1147 %%%%%%%%%%%%%%%%% START OF SAVING %%%%%%%%%%%%%%%%%%% | |
1148 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1150 | |
1151 | |
1152 function [] = savemap() | |
1153 global MAP MAPSAVED; | |
1154 if isempty(MAP) | |
1155 str = {'There is no map to be saved! Train map before saving.'}; | |
1156 helpdlg(str,'Empty map!'); | |
1157 return; | |
1158 end | |
1159 [FileName Path] = uiputfile('*.cod','Save file!'); | |
1160 if FileName ~= 0 | |
1161 temp = strcat(Path,FileName); | |
1162 som_write_cod(MAP,temp); | |
1163 MAPSAVED = 'SAVED'; | |
1164 end | |
1165 Handle = findobj(gcf,'Tag','StaticText10'); | |
1166 set(Handle,'String','Status <map saved>'); | |
1167 | |
1168 function [] = save_workspace() | |
1169 global MAP MAPSAVED; | |
1170 if isempty(MAP) | |
1171 str = {'There is no map to be saved! Train map before saving.'}; | |
1172 helpdlg(str,'Empty map!'); | |
1173 return; | |
1174 else | |
1175 prompt = {'Save map as?'}; | |
1176 title = 'Save map!'; | |
1177 lineNo = 1; | |
1178 answer = inputdlg(prompt,title,lineNo); | |
1179 if isempty(answer) | |
1180 return; | |
1181 end | |
1182 if not(isempty(answer{1})) | |
1183 ws_variable = evalin('base','who'); | |
1184 max_length = 0; | |
1185 for index = 1:size(ws_variable,1) | |
1186 if max_length < size(ws_variable{index},2) | |
1187 max_length = size(ws_variable{index},2); | |
1188 end | |
1189 end | |
1190 length = max_length + 1; | |
1191 tempfoo(1:1:length) = 'A'; | |
1192 assignin('base',tempfoo,answer{1}); | |
1193 str = ['exist(' tempfoo ')']; | |
1194 temp = evalin('base',str); %%%%%%%%%%@@@@@@@@@ | |
1195 evalin('base',['clear ' tempfoo ]) | |
1196 if temp == 0 | |
1197 assignin('base',answer{1},MAP); | |
1198 MAPSAVED = 'SAVED'; | |
1199 elseif temp ~= 0 | |
1200 Questmsg = strcat('Variable',' ''',answer{1},'''',... | |
1201 ' exist. Overwrite?'); | |
1202 ButtonName = questdlg(Questmsg); | |
1203 switch(ButtonName) | |
1204 case 'Yes' | |
1205 assignin('base',answer{1},MAP); | |
1206 MAPSAVED = 'SAVED'; | |
1207 case 'No' | |
1208 som_gui('save_workspace'); | |
1209 end | |
1210 end | |
1211 else | |
1212 helpmsg = {'There cannot be any empty field in ''save'''}; | |
1213 helpdlg(helpmsg,'Help Save!'); | |
1214 som_gui('save'); | |
1215 end | |
1216 end | |
1217 Handle = findobj(gcf,'Tag','StaticText10'); | |
1218 set(Handle,'String','Status <map saved>'); | |
1219 | |
1220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1221 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1222 %%%%%%%%%%%%%%%%% END OF SAVING %%%%%%%%%%%%%%%%%%% | |
1223 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1225 | |
1226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1227 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1228 %%%%%%%%%%%%%%%%% START OF HELP & INFO %%%%%%%%%%%%%%%%%%% | |
1229 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1231 | |
1232 %HEREXX | |
1233 | |
1234 function [] = data_info() | |
1235 global DATA; | |
1236 if isempty(DATA) | |
1237 helpmsg = 'Load data first!'; | |
1238 helpdlg(helpmsg,'Empty data!'); | |
1239 return; | |
1240 end | |
1241 file_name = tempname; | |
1242 file_name = strcat(file_name,'.m'); | |
1243 fid = fopen(file_name,'w'); | |
1244 fprintf(fid,'%% %+35s\n','DATA INFO'); | |
1245 fprintf(fid,'%%\n'); | |
1246 print_info(DATA,2,fid); | |
1247 directory = tempdir; | |
1248 addpath (directory); | |
1249 helpwin (file_name); | |
1250 fclose(fid); | |
1251 delete(file_name); | |
1252 rmpath (directory); | |
1253 | |
1254 | |
1255 function [] = map_info() | |
1256 global MAP; | |
1257 if isempty(MAP) | |
1258 helpmsg = 'There is no map!'; | |
1259 helpdlg(helpmsg,'Empty map!'); | |
1260 return; | |
1261 end | |
1262 file_name = tempname; | |
1263 file_name = strcat(file_name,'.m'); | |
1264 fid = fopen(file_name,'w'); | |
1265 fprintf(fid,'%% %+35s\n','MAP INFO'); | |
1266 fprintf(fid,'%%\n'); | |
1267 print_info(MAP,2,fid); | |
1268 directory = tempdir; | |
1269 addpath (directory); | |
1270 helpwin (file_name); | |
1271 fclose(fid); | |
1272 delete(file_name); | |
1273 rmpath (directory); | |
1274 | |
1275 | |
1276 function [] = helpwin1() | |
1277 file1 = tempname; | |
1278 file1 = strcat(file1,'.m'); | |
1279 directory = tempdir; | |
1280 html2tex('file:///share/somtoolbox/vs2/html/som_GUI.html',file1); | |
1281 addpath (directory); | |
1282 helpwin (file1); | |
1283 rmpath (directory); | |
1284 delete (file1); | |
1285 | |
1286 | |
1287 | |
1288 | |
1289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1290 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1291 %%%%%%%%%%%%%%%%% END OF HELP & INFO %%%%%%%%%%%%%%%%%%% | |
1292 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1294 | |
1295 | |
1296 | |
1297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1298 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1299 %%%%%%%%%%%%%%%%% START OF OTHER FUNC %%%%%%%%%%%%%%%%%%% | |
1300 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1302 | |
1303 | |
1304 | |
1305 function [msgs_nro, value, Handle] = check_ok(Tag) | |
1306 Handle = findobj(gcbf,'Tag',Tag); | |
1307 temp = get(Handle,'String'); | |
1308 value = str2num(temp); | |
1309 if isempty(value) | |
1310 msgs_nro = 1; | |
1311 return; | |
1312 end | |
1313 [test1 test2] = size(value); | |
1314 if test1 ~= 1 | test2 ~= 1 | |
1315 msgs_nro = 2; | |
1316 return; | |
1317 end | |
1318 msgs_nro = 0; | |
1319 | |
1320 | |
1321 function [msgs_nro, value, Handle] = msize_ok(Tag) | |
1322 Handle = findobj(gcbf,'Tag',Tag); | |
1323 temp = get(Handle,'String'); | |
1324 value = str2num(temp); | |
1325 if isempty(value) | |
1326 msgs_nro = 1; | |
1327 return; | |
1328 end | |
1329 [test1 test2] = size(value); | |
1330 if test1 ~= 1 | test2 ~= 2 | |
1331 msgs_nro = 2; | |
1332 return; | |
1333 end | |
1334 msgs_nro = 0; | |
1335 | |
1336 | |
1337 %%% Changed 1.2.2000 | |
1338 | |
1339 function [] = visualize() | |
1340 global MAP; | |
1341 if isempty(MAP) | |
1342 helpmsg = {'Train map before tryinig to visualize it!'}; | |
1343 helpdlg(helpmsg,'Empty Map!'); | |
1344 return; | |
1345 end | |
1346 | |
1347 dim = size(MAP.codebook,2); | |
1348 odim = 2; | |
1349 [P,V] = pcaproj(MAP.codebook,odim); | |
1350 ccode = som_colorcode(MAP, 'rgb1'); | |
1351 | |
1352 figure; | |
1353 som_show(MAP,'umat','all','comp',1:dim,'norm','d'); | |
1354 figure; | |
1355 subplot(1,2,1) | |
1356 som_grid(MAP,'Coord',P,'MarkerColor',ccode,'Markersize',5, ... | |
1357 'Linewidth',1,'Linecolor','k'); | |
1358 xlabel('PC1'), ylabel('PC2') | |
1359 title('PCA-projection (on the left), color coding (on the right)') | |
1360 axis tight, axis equal | |
1361 subplot(1,2,2) | |
1362 som_cplane(MAP.topol.lattice,MAP.topol.msize,ccode); | |
1363 | |
1364 %msgbox('Save map in workspace. Load it from there.'); | |
1365 %som_gui('save_workspace'); | |
1366 %som_comp_vis; | |
1367 | |
1368 %%%%%%%%%%%%%%%% | |
1369 | |
1370 | |
1371 function [] = clear_all() | |
1372 | |
1373 Handle = findobj(gcbf,'Enable','off'); | |
1374 set(Handle,'Enable','on'); | |
1375 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
1376 set(Handle,'Value',0); | |
1377 Handle = findobj(gcbf,'Tag','StaticText10'); | |
1378 set(Handle,'String','Status <no action>'); | |
1379 Handle = findobj(gcbf,'Tag','StaticText3'); | |
1380 set(Handle,'String','Map: <empty>'); | |
1381 Handle = findobj(gcbf,'Tag','StaticText4'); | |
1382 set(Handle,'String','Data: <empty>'); | |
1383 Handle = findobj(gcbf,'Tag','StaticText20'); | |
1384 set(Handle,'String','lattice:'); | |
1385 Handle = findobj(gcbf,'Tag','StaticText11'); | |
1386 set(Handle,'String','neigh:'); | |
1387 Handle = findobj(gcbf,'Tag','StaticText16'); | |
1388 set(Handle,'String','training length:'); | |
1389 Handle = findobj(gcbf,'Tag','StaticText23'); | |
1390 set(Handle,'String','training length:'); | |
1391 Handle = findobj(gcbf,'Tag','StaticText17'); | |
1392 set(Handle,'String','radius initial:'); | |
1393 Handle = findobj(gcbf,'Tag','StaticText24'); | |
1394 set(Handle,'String','radius initial:'); | |
1395 Handle = findobj(gcbf,'Tag','StaticText5'); | |
1396 set(Handle,'String','map size:'); | |
1397 Handle = findobj(gcbf,'Tag','StaticText21'); | |
1398 set(Handle,'String','shape:'); | |
1399 Handle = findobj(gcbf,'Tag','StaticText12'); | |
1400 set(Handle,'String','order:'); | |
1401 set(Handle,'Visible','off'); | |
1402 Handle = findobj(gcbf,'Tag','StaticText14'); | |
1403 set(Handle,'String','length type:'); | |
1404 set(Handle,'Visible','off'); | |
1405 Handle = findobj(gcbf,'Tag','StaticText22'); | |
1406 set(Handle,'String','radius final:'); | |
1407 Handle = findobj(gcbf,'Tag','StaticText25'); | |
1408 set(Handle,'String','radius final:'); | |
1409 Handle = findobj(gcbf,'Tag','StaticText19'); | |
1410 set(Handle,'String','tracking:'); | |
1411 Handle = findobj(gcbf,'Tag','StaticText7'); | |
1412 set(Handle,'String','Initialization'); | |
1413 Handle = findobj(gcbf,'Tag','StaticText28'); | |
1414 set(Handle,'String','alpha type:'); | |
1415 set(Handle,'Visible','off'); | |
1416 Handle = findobj(gcbf,'Tag','StaticText26'); | |
1417 set(Handle,'String','alpha initial:'); | |
1418 Handle = findobj(gcbf,'Tag','StaticText27'); | |
1419 set(Handle,'String','alpha initial:'); | |
1420 Handle = findobj(gcbf,'Tag','StaticText6'); | |
1421 set(Handle,'String','type:'); | |
1422 Handle = findobj(gcbf,'Tag','StaticText9'); | |
1423 set(Handle,'String','training type:'); | |
1424 Handle = findobj(gcbf,'Tag','Pushbutton9'); | |
1425 set(Handle,'Enable','off'); | |
1426 Handle = findobj(gcbf,'Tag','Pushbutton6'); | |
1427 set(Handle,'Enable','off'); | |
1428 Handle = findobj(gcbf,'Tag','Pushbutton4'); | |
1429 set(Handle,'Enable','off'); | |
1430 Handle = findobj(gcbf,'Tag','Pushbutton5'); | |
1431 set(Handle,'Enable','off'); | |
1432 Handle = findobj(gcbf,'Tag','Pushbutton2'); | |
1433 set(Handle,'Enable','on'); | |
1434 Handle = findobj(gcbf,'Tag','Radiobutton1'); | |
1435 set(Handle,'Enable','off'); | |
1436 Handle = findobj(gcbf,'Tag','Load/SaveSave mapuimenu1'); | |
1437 set(Handle,'Enable','off'); | |
1438 Handle = findobj(gcbf,'Tag','&Load/SaveSave mapSave in workspaceuimenu1'); | |
1439 set(Handle,'Enable','off'); | |
1440 Handle = findobj(gcbf,'Tag','Subuimenu2'); | |
1441 set(Handle,'Enable','off'); | |
1442 Handle = findobj(gcbf,'Tag','&ToolsSubuimenu1'); | |
1443 set(Handle,'Enable','off'); | |
1444 Handle = findobj(gcbf,'Tag','&Help/InfoHelp windowuimenu1'); | |
1445 set(Handle,'Enable','off'); | |
1446 Handle = findobj(gcbf,'Tag','&Help/InfoData infouimenu1'); | |
1447 set(Handle,'Enable','off'); | |
1448 Handle = findobj(gcbf,'Tag','&Init&Trainuimenu1'); | |
1449 set(Handle,'Enable','off'); | |
1450 Handle = findobj(gcbf,'Tag','&Init&TrainInitialize1'); | |
1451 set(Handle,'Enable','off'); | |
1452 Handle = findobj(gcbf,'Tag','&Init&TrainChange initialization valuesuimenu1'); | |
1453 set(Handle,'Enable','off'); | |
1454 Handle = findobj(gcbf,'Tag','&Init&TrainTrain1'); | |
1455 set(Handle,'Enable','off'); | |
1456 Handle = findobj(gcbf,'Tag','Load/SaveSubuimenu1'); | |
1457 set(Handle,'Enable','off'); | |
1458 Handle = findobj(gcbf,'String','alpha initial:'); | |
1459 set(Handle,'Visible','off'); | |
1460 clear; | |
1461 clear global; | |
1462 | |
1463 | |
1464 function [] = close_fig() | |
1465 global MAPSAVED NEWMAP; | |
1466 if isempty(MAPSAVED) | |
1467 if not(isempty(NEWMAP)) | |
1468 quest = 'Save map before closing?'; | |
1469 ButtonName = questdlg(quest); | |
1470 switch ButtonName | |
1471 case 'Yes' | |
1472 som_gui('savemap'); | |
1473 som_gui('clear'); | |
1474 clear global; | |
1475 close(gcbf); | |
1476 case 'No' | |
1477 som_gui('clear'); | |
1478 clear global; | |
1479 close(gcbf); | |
1480 case 'Cancel' | |
1481 end | |
1482 else | |
1483 som_gui('clear'); | |
1484 clear global; | |
1485 close(gcbf); | |
1486 end | |
1487 else | |
1488 som_gui('clear'); | |
1489 clear global; | |
1490 close(gcbf); | |
1491 end | |
1492 | |
1493 | |
1494 function [] = preprocess_gui() | |
1495 global DATA; | |
1496 if isempty(DATA) | |
1497 helpmsg = {'Load data before tryinig to preprocess!'}; | |
1498 helpdlg(helpmsg,'Empty Data!'); | |
1499 return; | |
1500 end | |
1501 preprocess(DATA); | |
1502 waitfor(gcf); | |
1503 prompt = {'Name of preprocessed data in workspace?'}; | |
1504 tittle = 'Reload preprocessed data!'; | |
1505 lineNo = 1; | |
1506 def = {DATA.name}; | |
1507 answer = inputdlg(prompt,tittle,lineNo,def); | |
1508 if isempty(answer) | |
1509 return; | |
1510 end | |
1511 data = answer{1}; | |
1512 new_name = retname; | |
1513 assignin('base',new_name,data); | |
1514 str = ['exist(' new_name ')']; | |
1515 temp = evalin('base',str); | |
1516 if temp ~= 1 | |
1517 temp = strcat('Variable ''',data,''' doesn''t exist in workspace.',... | |
1518 'Old Data which is not preprocessed will be used.'); | |
1519 errordlg(temp,'Unknown variable!'); | |
1520 return; | |
1521 end | |
1522 evalin('base',['clear ' new_name ]) | |
1523 Handle = findobj(gcf,'Tag','StaticText4'); | |
1524 temp = strcat('Data: <',data,'>'); | |
1525 set(Handle,'String',temp); | |
1526 Handle = findobj(gcf,'Tag','StaticText10'); | |
1527 set(Handle,'String','Status <data preprocessed>'); | |
1528 temp = evalin('base',data); | |
1529 DATA.data = temp; | |
1530 som_gui('def_initialization'); | |
1531 | |
1532 | |
1533 function [val] = loop(cell_data, search_data) | |
1534 for val = 1: length(cell_data) | |
1535 if strcmp(cell_data{val},search_data) | |
1536 break; | |
1537 end | |
1538 end | |
1539 if not(strcmp(cell_data{val},search_data)) | |
1540 val = -1; | |
1541 end | |
1542 | |
1543 | |
1544 function [] = comp_names(names,fid) | |
1545 last = size(names); | |
1546 for index=1:last | |
1547 fprintf(fid,'%% %s\n',names{index}) | |
1548 end | |
1549 | |
1550 function [] = fill_field(names,mask,fid) | |
1551 last = size(mask); | |
1552 for index=1:last | |
1553 num = num2str(mask(index)) | |
1554 fprintf(fid,'%% %-15s %-2s\n',names{index},num) | |
1555 end | |
1556 | |
1557 | |
1558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1559 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1560 %%%%%%%%%%%%%%%%% END OF OTHER FUNC %%%%%%%%%%%%%%%%%%% | |
1561 %%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% | |
1562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
1563 | |
1564 | |
1565 | |
1566 | |
1567 function fig = main_gui() | |
1568 | |
1569 v = version; | |
1570 ver_53_or_newer = (str2num(v(1:3)) >= 5.3); | |
1571 | |
1572 h0 = figure('Units','normalized', ... | |
1573 'Color',[0.85 0.85 0.85], ... | |
1574 'Name','SOM Toolbox -- Initialization & Training', ... | |
1575 'NumberTitle','off', ... | |
1576 'PaperPosition',[18 180 576 432], ... | |
1577 'PaperUnits','points', ... | |
1578 'Position',[0.3296875 0.28125 0.3828125 0.576171875], ... | |
1579 'Tag','Fig1'); | |
1580 if ver_53_or_newer, set(h0,'ToolBar','none'); end | |
1581 | |
1582 h1 = uimenu('Parent',h0, ... | |
1583 'Label','&Load/Save', ... | |
1584 'Tag','uimenu1'); | |
1585 h2 = uimenu('Parent',h1, ... | |
1586 'Callback','som_gui(''load_data'');',... | |
1587 'Label','Load Data', ... | |
1588 'Tag','Subuimenu1'); | |
1589 h2 = uimenu('Parent',h1, ... | |
1590 'Label','Save map', ... | |
1591 'Enable','off',... | |
1592 'Tag','Load/SaveSubuimenu1'); | |
1593 h3 = uimenu('Parent',h2, ... | |
1594 'Callback','som_gui(''save_workspace'');', ... | |
1595 'Enable','off', ... | |
1596 'Label','Save in workspace', ... | |
1597 'Tag','Load/SaveSave mapuimenu1'); | |
1598 h3 = uimenu('Parent',h2, ... | |
1599 'Callback','som_gui(''savemap'');', ... | |
1600 'Enable','off', ... | |
1601 'Label','Write cod-file', ... | |
1602 'Tag','&Load/SaveSave mapSave in workspaceuimenu1'); | |
1603 h1 = uimenu('Parent',h0, ... | |
1604 'Label','&Utilities', ... | |
1605 'Tag','uimenu2'); | |
1606 h2 = uimenu('Parent',h1, ... | |
1607 'Callback','som_gui(''preprocess'');', ... | |
1608 'Enable','off', ... | |
1609 'Label','Preprocess Data', ... | |
1610 'Tag','Subuimenu2'); | |
1611 h2 = uimenu('Parent',h1, ... | |
1612 'Callback','som_gui(''visualize'');', ... | |
1613 'Enable','off', ... | |
1614 'Label','Visualize Map', ... | |
1615 'Tag','&ToolsSubuimenu1'); | |
1616 h2 = uimenu('Parent',h1, ... | |
1617 'Callback','som_gui(''clear_all'');', ... | |
1618 'Label','Clear all', ... | |
1619 'Tag','&ToolsSubuimenu2'); | |
1620 h2 = uimenu('Parent',h1, ... | |
1621 'Callback','som_gui(''close'');', ... | |
1622 'Label','Close Figure', ... | |
1623 'Tag','&ToolsClear alluimenu1'); | |
1624 h1 = uimenu('Parent',h0, ... | |
1625 'Label','&Info', ... | |
1626 'Tag','&ToolsClose Figureuimenu1'); | |
1627 h2 = uimenu('Parent',h1, ... | |
1628 'Callback','som_gui(''help'');', ... | |
1629 'Label','WWW Help', ... | |
1630 'Tag','Helpuimenu1'); | |
1631 h2 = uimenu('Parent',h1, ... | |
1632 'Callback','som_gui(''helpwin'');', ... | |
1633 'Label','Help window', ... | |
1634 'Tag','Helpuimenu2'); | |
1635 h2 = uimenu('Parent',h1, ... | |
1636 'Callback','som_gui(''helpwin2'');', ... | |
1637 'Label','About GUI', ... | |
1638 'Tag','&Help/InfoHelp windowuimenu2'); | |
1639 h2 = uimenu('Parent',h1, ... | |
1640 'Callback','som_gui(''data_info'');', ... | |
1641 'Enable','off', ... | |
1642 'Label','Data info', ... | |
1643 'Tag','&Help/InfoHelp windowuimenu1'); | |
1644 h2 = uimenu('Parent',h1, ... | |
1645 'Callback','som_gui(''map_info'');', ... | |
1646 'Enable','off', ... | |
1647 'Label','Map info', ... | |
1648 'Tag','&Help/InfoData infouimenu1'); | |
1649 h1 = uimenu('Parent',h0, ... | |
1650 'Label','&Init/Train', ... | |
1651 'Tag','&Init/Train1'); | |
1652 h2 = uimenu('Parent',h1, ... | |
1653 'Callback','som_gui(''change_initialization'');', ... | |
1654 'Enable','off', ... | |
1655 'Label','Change initialization values', ... | |
1656 'Tag','&Init&Trainuimenu1'); | |
1657 h2 = uimenu('Parent',h1, ... | |
1658 'Callback','som_gui(''init'');', ... | |
1659 'Enable','off', ... | |
1660 'Label','Initialize', ... | |
1661 'Tag','&Init&TrainInitialize1'); | |
1662 h2 = uimenu('Parent',h1, ... | |
1663 'Callback','som_gui(''change_def'');', ... | |
1664 'Enable','off', ... | |
1665 'Label','Change training values', ... | |
1666 'Tag','&Init&TrainChange initialization valuesuimenu1'); | |
1667 h2 = uimenu('Parent',h1, ... | |
1668 'Callback','som_gui(''def_train'');', ... | |
1669 'Enable','off', ... | |
1670 'Label','Train', ... | |
1671 'Tag','&Init&TrainTrain1'); | |
1672 h1 = uicontrol('Parent',h0, ... | |
1673 'Units','normalized', ... | |
1674 'ListboxTop',0, ... | |
1675 'Position',[0.04081632653061224 0.01129943502824859 0.7619047619047619 0.9717514124293786], ... | |
1676 'Style','frame', ... | |
1677 'Tag','Frame1'); | |
1678 h1 = uicontrol('Parent',h0, ... | |
1679 'Units','normalized', ... | |
1680 'ListboxTop',0, ... | |
1681 'Position',[0.06802721088435373 0.7909604519774012 0.7074829931972788 0.1807909604519774], ... | |
1682 'Style','frame', ... | |
1683 'Tag','Frame2'); | |
1684 h1 = uicontrol('Parent',h0, ... | |
1685 'Units','normalized', ... | |
1686 'BackgroundColor',[0.9 0.9 0.9], ... | |
1687 'HorizontalAlignment','left', ... | |
1688 'ListboxTop',0, ... | |
1689 'Position',[0.09523809523809523 0.8527570621468927 0.6530612244897959 0.03389830508474576], ... | |
1690 'FontUnits','normalized',... | |
1691 'String','Map <empty>', ... | |
1692 'Style','text', ... | |
1693 'Tag','StaticText3'); | |
1694 h1 = uicontrol('Parent',h0, ... | |
1695 'Units','normalized', ... | |
1696 'BackgroundColor',[0.9 0.9 0.9], ... | |
1697 'HorizontalAlignment','left', ... | |
1698 'ListboxTop',0, ... | |
1699 'Position',[0.09523809523809523 0.8075593220338984 0.6530612244897959 0.03389830508474576], ... | |
1700 'String','Data <empty>', ... | |
1701 'FontUnits','normalized',... | |
1702 'Style','text', ... | |
1703 'Tag','StaticText4'); | |
1704 h1 = uicontrol('Parent',h0, ... | |
1705 'Units','normalized', ... | |
1706 'ListboxTop',0, ... | |
1707 'Position',[0.06802721088435373 0.5988700564971752 0.7074829931972788 0.1694915254237288], ... | |
1708 'Style','frame', ... | |
1709 'Tag','Frame3'); | |
1710 h1 = uicontrol('Parent',h0, ... | |
1711 'Units','normalized', ... | |
1712 'ListboxTop',0, ... | |
1713 'Position',[0.1041 0.7356 0.6286 0.0271], ... | |
1714 'String','Initialization', ... | |
1715 'FontUnits','normalized',... | |
1716 'Style','text', ... | |
1717 'FontWeight','bold', ... | |
1718 'Tag','StaticText7'); | |
1719 h1 = uicontrol('Parent',h0, ... | |
1720 'Units','normalized', ... | |
1721 'BackgroundColor',[0.9 0.9 0.9], ... | |
1722 'HorizontalAlignment','left', ... | |
1723 'ListboxTop',0, ... | |
1724 'Position',[0.4489795918367346 0.7005649717514124 0.2993197278911565 0.03389830508474576], ... | |
1725 'String','map size:', ... | |
1726 'FontUnits','normalized',... | |
1727 'Style','text', ... | |
1728 'Tag','StaticText5'); | |
1729 h1 = uicontrol('Parent',h0, ... | |
1730 'Units','normalized', ... | |
1731 'BackgroundColor',[0.9 0.9 0.9], ... | |
1732 'HorizontalAlignment','left', ... | |
1733 'ListboxTop',0, ... | |
1734 'Position',[0.09523809523809523 0.6553672316384182 0.2993197278911565 0.03389830508474576], ... | |
1735 'String','lattice:', ... | |
1736 'FontUnits','normalized',... | |
1737 'Style','text', ... | |
1738 'Tag','StaticText20'); | |
1739 h1 = uicontrol('Parent',h0, ... | |
1740 'Units','normalized', ... | |
1741 'BackgroundColor',[0.9 0.9 0.9], ... | |
1742 'HorizontalAlignment','left', ... | |
1743 'ListboxTop',0, ... | |
1744 'Position',[0.09523809523809523 0.7000000000000001 0.2993197278911565 0.03389830508474576], ... | |
1745 'String','type:', ... | |
1746 'FontUnits','normalized',... | |
1747 'Style','text', ... | |
1748 'Tag','StaticText6'); | |
1749 h1 = uicontrol('Parent',h0, ... | |
1750 'Units','normalized', ... | |
1751 'BackgroundColor',[0.9 0.9 0.9], ... | |
1752 'HorizontalAlignment','left', ... | |
1753 'ListboxTop',0, ... | |
1754 'Position',[0.4489795918367346 0.6553672316384182 0.2993197278911565 0.03389830508474576], ... | |
1755 'String','shape:', ... | |
1756 'FontUnits','normalized',... | |
1757 'Style','text', ... | |
1758 'Tag','StaticText21'); | |
1759 h1 = uicontrol('Parent',h0, ... | |
1760 'Units','normalized', ... | |
1761 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
1762 'ListboxTop',0, ... | |
1763 'Position',[0.3129251700680272 0.6101694915254238 0.217687074829932 0.03389830508474576], ... | |
1764 'String','Change values', ... | |
1765 'FontUnits','normalized',... | |
1766 'Callback','som_gui(''change_initialization'');', ... | |
1767 'Enable','off', ... | |
1768 'Tag','Pushbutton9'); | |
1769 h1 = uicontrol('Parent',h0, ... | |
1770 'Units','normalized', ... | |
1771 'ListboxTop',0, ... | |
1772 'Position',[0.06802721088435373 0.02259887005649718 0.7074829931972788 0.5536723163841808], ... | |
1773 'Style','frame', ... | |
1774 'Tag','Frame4'); | |
1775 h1 = uicontrol('Parent',h0, ... | |
1776 'Units','normalized', ... | |
1777 'ListboxTop',0, ... | |
1778 'Position',[0.1041 0.5316 0.6429 0.0339], ... | |
1779 'String','Training', ... | |
1780 'FontUnits','normalized',... | |
1781 'Style','text', ... | |
1782 'FontWeight','bold', ... | |
1783 'Tag','StaticText8'); | |
1784 h1 = uicontrol('Parent',h0, ... | |
1785 'Units','normalized', ... | |
1786 'BackgroundColor',[0.9 0.9 0.9], ... | |
1787 'ListboxTop',0, ... | |
1788 'Position',[0.09523809523809523 0.4971751412429379 0.6530612244897959 0.03389830508474576], ... | |
1789 'String','training type', ... | |
1790 'FontUnits','normalized',... | |
1791 'Style','text', ... | |
1792 'Tag','StaticText9'); | |
1793 h1 = uicontrol('Parent',h0, ... | |
1794 'Units','normalized', ... | |
1795 'BackgroundColor',[0.9 0.9 0.9], ... | |
1796 'HorizontalAlignment','left', ... | |
1797 'ListboxTop',0, ... | |
1798 'Position',[0.4489795918367346 0.4519774011299435 0.2993197278911565 0.03389830508474576], ... | |
1799 'String','tracking:', ... | |
1800 'FontUnits','normalized',... | |
1801 'Style','text', ... | |
1802 'Tag','StaticText19'); | |
1803 h1 = uicontrol('Parent',h0, ... | |
1804 'Units','normalized', ... | |
1805 'BackgroundColor',[0.9 0.9 0.9], ... | |
1806 'HorizontalAlignment','left', ... | |
1807 'ListboxTop',0, ... | |
1808 'Position',[0.09523809523809523 0.4519774011299435 0.2993197278911565 0.03389830508474576], ... | |
1809 'String','neigh:', ... | |
1810 'FontUnits','normalized',... | |
1811 'Style','text', ... | |
1812 'Tag','StaticText11'); | |
1813 h1 = uicontrol('Parent',h0, ... | |
1814 'Units','normalized', ... | |
1815 'HorizontalAlignment','left', ... | |
1816 'BackgroundColor',[0.9 0.9 0.9], ... | |
1817 'ListboxTop',0, ... | |
1818 'Position',[0.09523809523809523 0.36519774011299435 0.2993197278911565 0.03389830508474576], ... | |
1819 'String','alpha type:', ... | |
1820 'FontUnits','normalized',... | |
1821 'Style','text', ... | |
1822 'Visible','off',... | |
1823 'Tag','StaticText28'); | |
1824 h1 = uicontrol('Parent',h0, ... | |
1825 'Units','normalized', ... | |
1826 'BackgroundColor',[0.9 0.9 0.9], ... | |
1827 'ListboxTop',0, ... | |
1828 'HorizontalAlignment','left', ... | |
1829 'Position',[0.09523809523809523 0.4067796610169492 0.2993197278911565 0.03389830508474576], ... | |
1830 'String','length type:', ... | |
1831 'FontUnits','normalized',... | |
1832 'Style','text', ... | |
1833 'Visible','off',... | |
1834 'Tag','StaticText14'); | |
1835 h1 = uicontrol('Parent',h0, ... | |
1836 'Units','normalized', ... | |
1837 'BackgroundColor',[0.9 0.9 0.9], ... | |
1838 'HorizontalAlignment','left', ... | |
1839 'ListboxTop',0, ... | |
1840 'Position',[0.4489795918367346 0.4067796610169492 0.2993197278911565 0.03389830508474576], ... | |
1841 'String','order:', ... | |
1842 'FontUnits','normalized',... | |
1843 'Style','text', ... | |
1844 'Visible','off',... | |
1845 'Tag','StaticText12'); | |
1846 h1 = uicontrol('Parent',h0, ... | |
1847 'Units','normalized', ... | |
1848 'ListboxTop',0, ... | |
1849 'Position',[0.09523809523809523 0.07909604519774012 0.2993197278911565 0.2711864406779661], ... | |
1850 'Style','frame', ... | |
1851 'Tag','Frame5'); | |
1852 h1 = uicontrol('Parent',h0, ... | |
1853 'Units','normalized', ... | |
1854 'ListboxTop',0, ... | |
1855 'Position',[0.4353741496598639 0.07909604519774012 0.2993197278911565 0.2711864406779661], ... | |
1856 'Style','frame', ... | |
1857 'Tag','Frame6'); | |
1858 h1 = uicontrol('Parent',h0, ... | |
1859 'Units','normalized', ... | |
1860 'ListboxTop',0, ... | |
1861 'Position',[0.108843537414966 0.3050847457627119 0.2721088435374149 0.03389830508474576], ... | |
1862 'String','Rough', ... | |
1863 'FontUnits','normalized',... | |
1864 'Style','text', ... | |
1865 'Tag','StaticText13'); | |
1866 h1 = uicontrol('Parent',h0, ... | |
1867 'Units','normalized', ... | |
1868 'ListboxTop',0, ... | |
1869 'Position',[0.4489795918367346 0.3050847457627119 0.2721088435374149 0.03389830508474576], ... | |
1870 'String','Finetune', ... | |
1871 'FontUnits','normalized',... | |
1872 'Style','text', ... | |
1873 'Tag','StaticText15'); | |
1874 h1 = uicontrol('Parent',h0, ... | |
1875 'Units','normalized', ... | |
1876 'BackgroundColor',[0.9 0.9 0.9], ... | |
1877 'HorizontalAlignment','left', ... | |
1878 'ListboxTop',0, ... | |
1879 'Position',[0.108843537414966 0.1807909604519774 0.2721088435374149 0.03389830508474576], ... | |
1880 'String','training length:', ... | |
1881 'FontUnits','normalized',... | |
1882 'Style','text', ... | |
1883 'Tag','StaticText16'); | |
1884 h1 = uicontrol('Parent',h0, ... | |
1885 'Units','normalized', ... | |
1886 'BackgroundColor',[0.9 0.9 0.9], ... | |
1887 'HorizontalAlignment','left', ... | |
1888 'ListboxTop',0, ... | |
1889 'Position',[0.108843537414966 0.2694915254237288 0.2714285714285714 0.03389830508474576], ... | |
1890 'String','radius initial:', ... | |
1891 'FontUnits','normalized',... | |
1892 'Style','text', ... | |
1893 'Tag','StaticText17'); | |
1894 h1 = uicontrol('Parent',h0, ... | |
1895 'Units','normalized', ... | |
1896 'BackgroundColor',[0.9 0.9 0.9], ... | |
1897 'HorizontalAlignment','left', ... | |
1898 'ListboxTop',0, ... | |
1899 'Position',[0.1088 0.2260 0.2721 0.0339], ... | |
1900 'String','radius final:', ... | |
1901 'FontUnits','normalized',... | |
1902 'Style','text', ... | |
1903 'Tag','StaticText22'); | |
1904 h1 = uicontrol('Parent',h0, ... | |
1905 'Units','normalized', ... | |
1906 'BackgroundColor',[0.9 0.9 0.9], ... | |
1907 'ListboxTop',0, ... | |
1908 'Position',[0.108843537414966 0.13694915254237288 0.2714285714285714 0.03389830508474576], ... | |
1909 'String','alpha initial:', ... | |
1910 'FontUnits','normalized',... | |
1911 'HorizontalAlignment','left', ... | |
1912 'Style','text', ... | |
1913 'Visible','off',... | |
1914 'Tag','StaticText26'); | |
1915 h1 = uicontrol('Parent',h0, ... | |
1916 'Units','normalized', ... | |
1917 'BackgroundColor',[0.9 0.9 0.9], ... | |
1918 'HorizontalAlignment','left', ... | |
1919 'ListboxTop',0, ... | |
1920 'Position',[0.4489795918367346 0.1807909604519774 0.2721088435374149 0.03389830508474576], ... | |
1921 'String','training length:', ... | |
1922 'FontUnits','normalized',... | |
1923 'Style','text', ... | |
1924 'Tag','StaticText23'); | |
1925 h1 = uicontrol('Parent',h0, ... | |
1926 'Units','normalized', ... | |
1927 'BackgroundColor',[0.9 0.9 0.9], ... | |
1928 'HorizontalAlignment','left', ... | |
1929 'ListboxTop',0, ... | |
1930 'Position',[0.4489795918367346 0.2711864406779661 0.2721088435374149 0.03389830508474576], ... | |
1931 'String','radius initial:', ... | |
1932 'FontUnits','normalized',... | |
1933 'Style','text', ... | |
1934 'Tag','StaticText24'); | |
1935 h1 = uicontrol('Parent',h0, ... | |
1936 'Units','normalized', ... | |
1937 'BackgroundColor',[0.9 0.9 0.9], ... | |
1938 'HorizontalAlignment','left', ... | |
1939 'ListboxTop',0, ... | |
1940 'Position',[0.4490 0.2260 0.2721 0.0339], ... | |
1941 'String','radius final:', ... | |
1942 'FontUnits','normalized',... | |
1943 'Style','text', ... | |
1944 'Tag','StaticText25'); | |
1945 h1 = uicontrol('Parent',h0, ... | |
1946 'Units','normalized', ... | |
1947 'BackgroundColor',[0.9 0.9 0.9], ... | |
1948 'ListboxTop',0, ... | |
1949 'Position',[0.4489795918367346 0.13694915254237288 0.2721088435374149 0.03389830508474576], ... | |
1950 'String','alpha initial:', ... | |
1951 'FontUnits','normalized',... | |
1952 'HorizontalAlignment','left', ... | |
1953 'Style','text', ... | |
1954 'Visible','off',... | |
1955 'Tag','StaticText27'); | |
1956 h1 = uicontrol('Parent',h0, ... | |
1957 'Units','normalized', ... | |
1958 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
1959 'ListboxTop',0, ... | |
1960 'Position',[0.3129251700680272 0.03389830508474576 0.217687074829932 0.03389830508474576], ... | |
1961 'String','Change values', ... | |
1962 'FontUnits','normalized',... | |
1963 'Callback','som_gui(''change_def'');', ... | |
1964 'Enable','off', ... | |
1965 'Tag','Pushbutton6'); | |
1966 if ver_53_or_newer, set(h1,'TooltipString','Change default values in training.'); end | |
1967 | |
1968 h1 = uicontrol('Parent',h0, ... | |
1969 'Units','normalized', ... | |
1970 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
1971 'ListboxTop',0, ... | |
1972 'Position',[0.8163265306122448 0.8152542372881356 0.163265306122449 0.05593220338983051], ... | |
1973 'String','LOAD', ... | |
1974 'FontUnits','normalized',... | |
1975 'Callback','som_gui(''load_data'');', ... | |
1976 'Tag','Pushbutton2'); | |
1977 if ver_53_or_newer, set(h1,'TooltipString','Load data file.'); end | |
1978 | |
1979 h1 = uicontrol('Parent',h0, ... | |
1980 'Units','normalized', ... | |
1981 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
1982 'ListboxTop',0, ... | |
1983 'Position',[0.8163265306122448 0.6457627118644068 0.163265306122449 0.05593220338983051], ... | |
1984 'String','INITIALIZE', ... | |
1985 'FontUnits','normalized',... | |
1986 'Callback','som_gui(''init'');', ... | |
1987 'Enable','off', ... | |
1988 'Tag','Pushbutton4'); | |
1989 if ver_53_or_newer, set(h1,'TooltipString','Initialize map.'); end | |
1990 | |
1991 h1 = uicontrol('Parent',h0, ... | |
1992 'Units','normalized', ... | |
1993 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
1994 'ListboxTop',0, ... | |
1995 'Position',[0.8163265306122448 0.384180790960452 0.163265306122449 0.05649717514124294], ... | |
1996 'String','TRAIN', ... | |
1997 'FontUnits','normalized',... | |
1998 'Callback','som_gui(''def_train'');', ... | |
1999 'Enable','off', ... | |
2000 'Tag','Pushbutton5'); | |
2001 if ver_53_or_newer, set(h1,'TooltipString','Train map whit default values.'); end | |
2002 | |
2003 h1 = uicontrol('Parent',h0, ... | |
2004 'Units','normalized', ... | |
2005 'BackgroundColor',[0.752941176470588 0.752941176470588 0.752941176470588], ... | |
2006 'ListboxTop',0, ... | |
2007 'Position',[0.8163265306122448 0.06779661016949153 0.163265306122449 0.05649717514124294], ... | |
2008 'Callback','som_gui(''close'');', ... | |
2009 'String','CLOSE', ... | |
2010 'FontUnits','normalized',... | |
2011 'Tag','Pushbutton8'); | |
2012 if ver_53_or_newer, set(h1,'TooltipString','Close figure.'); end | |
2013 | |
2014 h1 = uicontrol('Parent',h0, ... | |
2015 'Units','normalized', ... | |
2016 'BackgroundColor',[0.9 0.9 0.9], ... | |
2017 'HorizontalAlignment','left', ... | |
2018 'ListboxTop',0, ... | |
2019 'Position',[0.09387755102040815 0.897954802259887 0.6530612244897959 0.03389830508474576], ... | |
2020 'String','Status <no action>', ... | |
2021 'FontUnits','normalized',... | |
2022 'Style','text', ... | |
2023 'Tag','StaticText10'); | |
2024 h1 = uicontrol('Parent',h0, ... | |
2025 'Units','normalized', ... | |
2026 'ListboxTop',0, ... | |
2027 'Position',[0.108843537414966 0.0903954802259887 0.2721088435374149 0.03389830508474576], ... | |
2028 'String','Only finetune', ... | |
2029 'FontUnits','normalized',... | |
2030 'Callback','som_gui(''only_finetune'');', ... | |
2031 'Enable','off', ... | |
2032 'Style','radiobutton', ... | |
2033 'Tag','Radiobutton1'); | |
2034 h1 = uicontrol('Parent',h0, ... | |
2035 'Units','normalized', ... | |
2036 'ListboxTop',0, ... | |
2037 'Position',[0.09523809523809523 0.9418531073446328 0.6530612244897959 0.0259887005649718], ... | |
2038 'String','Information', ... | |
2039 'FontUnits','normalized',... | |
2040 'FontWeight','bold', ... | |
2041 'Style','text', ... | |
2042 'Tag','StaticText18'); | |
2043 if nargout > 0, fig = h0; end | |
2044 | |
2045 | |
2046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2047 | |
2048 | |
2049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2050 | |
2051 function fig = loadgui3() | |
2052 | |
2053 temp = {'dat file';'mat file'}; | |
2054 | |
2055 h0 = figure('Units','normalized', ... | |
2056 'Color',[0.8 0.8 0.8], ... | |
2057 'Name','Load data!', ... | |
2058 'NumberTitle','off', ... | |
2059 'PaperType','a4letter', ... | |
2060 'Position',[0.3828125 0.5 0.3421875 0.189453125], ... | |
2061 'Tag','Fig1'); | |
2062 | |
2063 h1 = uicontrol('Parent',h0, ... | |
2064 'Units','normalized', ... | |
2065 'ListboxTop',0, ... | |
2066 'Position',[0.02853881278538813 0.06443298969072164 0.7705479452054794 0.8698453608247422], ... | |
2067 'Style','frame', ... | |
2068 'Tag','Frame1'); | |
2069 h1 = uicontrol('Parent',h0, ... | |
2070 'Units','normalized', ... | |
2071 'ListboxTop',0, ... | |
2072 'Position',[0.04337899543378995 0.547680412371134 0.7420091324200913 0.354381443298969], ... | |
2073 'Style','frame', ... | |
2074 'Tag','Frame2'); | |
2075 h1 = uicontrol('Parent',h0, ... | |
2076 'Units','normalized', ... | |
2077 'ListboxTop',0, ... | |
2078 'Position',[0.04280821917808219 0.09664948453608246 0.7420091324200913 0.4188144329896907], ... | |
2079 'Style','frame', ... | |
2080 'Tag','Frame3'); | |
2081 h1 = uicontrol('Parent',h0, ... | |
2082 'Units','normalized', ... | |
2083 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2084 'FontWeight','bold', ... | |
2085 'HorizontalAlignment','left', ... | |
2086 'ListboxTop',0, ... | |
2087 'Position',[0.05717762557077625 0.7881958762886597 0.2853881278538812 0.09664948453608246], ... | |
2088 'String','From', ... | |
2089 'FontUnits','normalized',... | |
2090 'Style','text', ... | |
2091 'Tag','StaticText1'); | |
2092 h1 = uicontrol('Parent',h0, ... | |
2093 'Units','normalized', ... | |
2094 'Callback','som_gui(''workspace'');', ... | |
2095 'ListboxTop',0, ... | |
2096 'Position',[0.05107762557077625 0.7087628865979381 0.1997716894977169 0.09664948453608246], ... | |
2097 'String','Ws', ... | |
2098 'FontUnits','normalized',... | |
2099 'Style','radiobutton', ... | |
2100 'Tag','Radiobutton2'); | |
2101 h1 = uicontrol('Parent',h0, ... | |
2102 'Units','normalized', ... | |
2103 'Callback','som_gui(''file'');', ... | |
2104 'ListboxTop',0, ... | |
2105 'Position',[0.05107762557077625 0.5773195876288659 0.2009132420091324 0.09793814432989689], ... | |
2106 'String','File', ... | |
2107 'FontUnits','normalized',... | |
2108 'Style','radiobutton', ... | |
2109 'Tag','Radiobutton1'); | |
2110 h1 = uicontrol('Parent',h0, ... | |
2111 'Units','normalized', ... | |
2112 'BackgroundColor',[1 1 1], ... | |
2113 'Callback','Handle = findobj(gcbf,''Tag'',''EditText2'');set(Handle,''String'','''');',... | |
2114 'FontUnits','normalized',... | |
2115 'HorizontalAlignment','left', ... | |
2116 'ListboxTop',0, ... | |
2117 'Position',[0.2893881278538812 0.7087628865979381 0.3139269406392694 0.09664948453608246], ... | |
2118 'Style','edit', ... | |
2119 'Tag','EditText1'); | |
2120 h1 = uicontrol('Parent',h0, ... | |
2121 'Units','normalized', ... | |
2122 'BackgroundColor',[1 1 1], ... | |
2123 'Callback','Handle = findobj(gcbf,''Tag'',''EditText1'');set(Handle,''String'','''');',... | |
2124 'FontUnits','normalized',... | |
2125 'HorizontalAlignment','left', ... | |
2126 'ListboxTop',0, ... | |
2127 'Position',[0.2893881278538812 0.5798969072164948 0.3139269406392694 0.09664948453608246], ... | |
2128 'Style','edit', ... | |
2129 'Tag','EditText2'); | |
2130 h1 = uicontrol('Parent',h0, ... | |
2131 'Units','normalized', ... | |
2132 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2133 'Callback','som_gui(''browse'');', ... | |
2134 'ListboxTop',0, ... | |
2135 'Position',[0.6279 0.5799 0.1427 0.2255], ... | |
2136 'String','Browse', ... | |
2137 'FontUnits','normalized',... | |
2138 'Tag','Pushbutton1'); | |
2139 h1 = uicontrol('Parent',h0, ... | |
2140 'Units','normalized', ... | |
2141 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2142 'Callback','som_gui(''load_ok'');', ... | |
2143 'ListboxTop',0, ... | |
2144 'Position',[0.8276 0.5577 0.1427 0.2255], ... | |
2145 'String','Load', ... | |
2146 'FontUnits','normalized',... | |
2147 'Tag','Pushbutton2'); | |
2148 h1 = uicontrol('Parent',h0, ... | |
2149 'Units','normalized', ... | |
2150 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2151 'Callback','close;',... | |
2152 'ListboxTop',0, ... | |
2153 'Position',[0.8276 0.2577 0.1427 0.2255], ... | |
2154 'String','Cancel', ... | |
2155 'FontUnits','normalized',... | |
2156 'Tag','Pushbutton3'); | |
2157 h1 = uicontrol('Parent',h0, ... | |
2158 'Units','normalized', ... | |
2159 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2160 'Callback','som_gui(''file_select'');', ... | |
2161 'ListboxTop',0, ... | |
2162 'Max',2, ... | |
2163 'Min',1, ... | |
2164 'String',temp,... | |
2165 'FontUnits','normalized',... | |
2166 'Position',[0.3995433789954338 0.2977319587628866 0.1997716894977169 0.08664948453608246], ... | |
2167 'Style','popupmenu', ... | |
2168 'Tag','PopupMenu1', ... | |
2169 'Value',1); | |
2170 h1 = uicontrol('Parent',h0, ... | |
2171 'Units','normalized', ... | |
2172 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2173 'FontWeight','bold', ... | |
2174 'HorizontalAlignment','left', ... | |
2175 'ListboxTop',0, ... | |
2176 'Position',[0.05707762557077625 0.3865979381443299 0.7134703196347032 0.09664948453608246], ... | |
2177 'String','Parameters for file', ... | |
2178 'FontUnits','normalized',... | |
2179 'Style','text', ... | |
2180 'Tag','StaticText2'); | |
2181 h1 = uicontrol('Parent',h0, ... | |
2182 'Units','normalized', ... | |
2183 'HorizontalAlignment','left', ... | |
2184 'ListboxTop',0, ... | |
2185 'Position',[0.05707762557077625 0.2777319587628866 0.2568493150684931 0.09664948453608246], ... | |
2186 'String','File type ', ... | |
2187 'FontUnits','normalized',... | |
2188 'Style','text', ... | |
2189 'Tag','StaticText3'); | |
2190 h1 = uicontrol('Parent',h0, ... | |
2191 'Units','normalized', ... | |
2192 'ListboxTop',0, ... | |
2193 'Position',[0.05707762557077625 0.1288659793814433 0.2996575342465753 0.09664948453608246], ... | |
2194 'String','Missing value', ... | |
2195 'Style','checkbox', ... | |
2196 'FontUnits','normalized',... | |
2197 'Tag','Checkbox1'); | |
2198 h1 = uicontrol('Parent',h0, ... | |
2199 'Units','normalized', ... | |
2200 'BackgroundColor',[1 1 1], ... | |
2201 'Callback','som_gui(''missing'');',... | |
2202 'ListboxTop',0, ... | |
2203 'Position',[0.5136986301369862 0.1258659793814433 0.08561643835616438 0.10664948453608246], ... | |
2204 'String','x', ... | |
2205 'FontUnits','normalized',... | |
2206 'Style','edit', ... | |
2207 'Tag','EditText3'); | |
2208 if nargout > 0, fig = h0; end | |
2209 | |
2210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2211 | |
2212 | |
2213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2214 | |
2215 | |
2216 | |
2217 | |
2218 function fig = works() | |
2219 | |
2220 v = version; | |
2221 ver_53_or_newer = (str2num(v(1:3)) >= 5.3); | |
2222 | |
2223 h0 = figure('Units','normalized', ... | |
2224 'Color',[0.8 0.8 0.8], ... | |
2225 'Name','Load from workspace!', ... | |
2226 'NumberTitle','off', ... | |
2227 'PaperPosition',[18 180 576 432], ... | |
2228 'PaperType','a4letter', ... | |
2229 'PaperUnits','points', ... | |
2230 'Position',[0.5390625 0.2490234375 0.203125 0.251953125], ... | |
2231 'Tag','Fig1'); | |
2232 if ver_53_or_newer, set(h0,'ToolBar','none'); end | |
2233 | |
2234 h1 = uicontrol('Parent',h0, ... | |
2235 'Units','normalized', ... | |
2236 'ListboxTop',0, ... | |
2237 'Position',[0.05384615384615385 0.1472868217054263 0.9076923076923078 0.8255813953488372], ... | |
2238 'Style','frame', ... | |
2239 'Tag','Frame1'); | |
2240 h1 = uicontrol('Parent',h0, ... | |
2241 'Units','normalized', ... | |
2242 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2243 'Callback','som_gui(''works_ok'');', ... | |
2244 'ListboxTop',0, ... | |
2245 'Position',[0.1077 0.0194 0.2885 0.1202], ... | |
2246 'String','OK', ... | |
2247 'FontUnits','normalized',... | |
2248 'Tag','Pushbutton1'); | |
2249 h1 = uicontrol('Parent',h0, ... | |
2250 'Units','normalized', ... | |
2251 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2252 'Callback','close;', ... | |
2253 'ListboxTop',0, ... | |
2254 'Position',[0.6115 0.0155 0.2885 0.1202], ... | |
2255 'String','Cancel', ... | |
2256 'FontUnits','normalized',... | |
2257 'Tag','Pushbutton2'); | |
2258 h1 = uicontrol('Parent',h0, ... | |
2259 'Units','normalized', ... | |
2260 'BackgroundColor',[1 1 1], ... | |
2261 'Position',[0.1192 0.1977 0.7692 0.6395], ... | |
2262 'String',' ', ... | |
2263 'FontUnits','normalized',... | |
2264 'Style','listbox', ... | |
2265 'Tag','Listbox1', ... | |
2266 'Value',1); | |
2267 h1 = uicontrol('Parent',h0, ... | |
2268 'Units','normalized', ... | |
2269 'FontWeight','bold', ... | |
2270 'ListboxTop',0, ... | |
2271 'Position',[0.2115384615384616 0.8720930232558139 0.576923076923077 0.06976744186046512], ... | |
2272 'String','Your options', ... | |
2273 'FontUnits','normalized',... | |
2274 'Style','text', ... | |
2275 'Tag','StaticText1'); | |
2276 if nargout > 0, fig = h0; end | |
2277 | |
2278 | |
2279 | |
2280 | |
2281 | |
2282 | |
2283 function fig = initialization2() | |
2284 | |
2285 | |
2286 temp1 = {'random';'linear'}; | |
2287 temp2 = {'hexa';'rect'}; | |
2288 temp3 = {'sheet';'cyl';'toroid'}; | |
2289 | |
2290 | |
2291 | |
2292 % position bug in following corrected 1.12.04 KimmoR | |
2293 h0 = figure('Units','normalized', ... | |
2294 'Color',[0.8 0.8 0.8], ... | |
2295 'Name','Change initialization parameters!', ... | |
2296 'NumberTitle','off', ... | |
2297 'PaperType','a4letter', ... | |
2298 'Position',[0.48828125 0.4267578125 0.3515625 0.146484375], ... | |
2299 'Tag','Fig1'); | |
2300 h1 = uicontrol('Parent',h0, ... | |
2301 'Units','normalized', ... | |
2302 'ListboxTop',0, ... | |
2303 'Position',[0.02777777777777778 0.08333333333333333 0.8055555555555556 0.8333333333333334], ... | |
2304 'Style','frame', ... | |
2305 'Tag','Frame1'); | |
2306 h1 = uicontrol('Parent',h0, ... | |
2307 'Units','normalized', ... | |
2308 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2309 'Callback','som_gui(''change_initialization_ok'');', ... | |
2310 'ListboxTop',0, ... | |
2311 'Position',[0.8472222222222222 0.55 0.125 0.25], ... | |
2312 'FontUnits','normalized',... | |
2313 'String','OK', ... | |
2314 'Tag','Pushbutton1'); | |
2315 h1 = uicontrol('Parent',h0, ... | |
2316 'Units','normalized', ... | |
2317 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2318 'Callback','som_gui(''change_initialization_cancel'');', ... | |
2319 'ListboxTop',0, ... | |
2320 'Position',[0.8472222222222222 0.25 0.125 0.25], ... | |
2321 'FontUnits','normalized',... | |
2322 'String','Cancel', ... | |
2323 'Tag','Pushbutton2'); | |
2324 h1 = uicontrol('Parent',h0, ... | |
2325 'Units','normalized', ... | |
2326 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2327 'FontWeight','bold', ... | |
2328 'HorizontalAlignment','left', ... | |
2329 'ListboxTop',0, ... | |
2330 'Position',[0.08333333333333334 0.6666666666666666 0.7066666666666667 0.1933333333333333], ... | |
2331 'String','Initialization parameters:', ... | |
2332 'FontUnits','normalized',... | |
2333 'Style','text', ... | |
2334 'Tag','StaticText1'); | |
2335 h1 = uicontrol('Parent',h0, ... | |
2336 'Units','normalized', ... | |
2337 'HorizontalAlignment','left', ... | |
2338 'ListboxTop',0, ... | |
2339 'Position',[0.0556 0.200 0.1667 0.1250],... | |
2340 'String','type:', ... | |
2341 'FontUnits','normalized',... | |
2342 'Style','text', ... | |
2343 'Tag','StaticText2'); | |
2344 h1 = uicontrol('Parent',h0, ... | |
2345 'Units','normalized', ... | |
2346 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2347 'ListboxTop',0, ... | |
2348 'Max',2, ... | |
2349 'Min',1, ... | |
2350 'Position',[0.2500 0.200 0.1667 0.1250], ... | |
2351 'String',temp1, ... | |
2352 'FontUnits','normalized',... | |
2353 'Style','popupmenu', ... | |
2354 'Tag','PopupMenu1', ... | |
2355 'Value',1); | |
2356 h1 = uicontrol('Parent',h0, ... | |
2357 'Units','normalized', ... | |
2358 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2359 'HorizontalAlignment','left', ... | |
2360 'ListboxTop',0, ... | |
2361 'Position',[0.05555555555555556 0.6 0.1666666666666667 0.125], ... | |
2362 'String','map size:', ... | |
2363 'FontUnits','normalized',... | |
2364 'Style','text', ... | |
2365 'Tag','StaticText2'); | |
2366 h1 = uicontrol('Parent',h0, ... | |
2367 'Units','normalized', ... | |
2368 'BackgroundColor',[1 1 1], ... | |
2369 'Callback','som_gui(''map_size'');', ... | |
2370 'HorizontalAlignment','left', ... | |
2371 'ListboxTop',0, ... | |
2372 'Position',[0.25 0.6 0.1666666666666667 0.125], ... | |
2373 'FontUnits','normalized',... | |
2374 'Style','edit', ... | |
2375 'Tag','EditText1'); | |
2376 h1 = uicontrol('Parent',h0, ... | |
2377 'Units','normalized', ... | |
2378 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2379 'HorizontalAlignment','left', ... | |
2380 'ListboxTop',0, ... | |
2381 'Position',[0.05555555555555556 0.4033333333333333 0.1666666666666667 0.125], ... | |
2382 'String','lattice:', ... | |
2383 'FontUnits','normalized',... | |
2384 'Style','text', ... | |
2385 'Tag','StaticText3'); | |
2386 h1 = uicontrol('Parent',h0, ... | |
2387 'Units','normalized', ... | |
2388 'ListboxTop',0, ... | |
2389 'Max',2, ... | |
2390 'Min',1, ... | |
2391 'Position',[0.25 0.4333333333333333 0.1666666666666667 0.125], ... | |
2392 'String',temp2, ... | |
2393 'FontUnits','normalized',... | |
2394 'Style','popupmenu', ... | |
2395 'Tag','PopupMenu2', ... | |
2396 'Value',2); | |
2397 h1 = uicontrol('Parent',h0, ... | |
2398 'Units','normalized', ... | |
2399 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2400 'HorizontalAlignment','left', ... | |
2401 'ListboxTop',0, ... | |
2402 'Position',[0.4444444444444445 0.4033333333333333 0.1666666666666667 0.125], ... | |
2403 'String','shape:', ... | |
2404 'FontUnits','normalized',... | |
2405 'Style','text', ... | |
2406 'Tag','StaticText4'); | |
2407 h1 = uicontrol('Parent',h0, ... | |
2408 'Units','normalized', ... | |
2409 'ListboxTop',0, ... | |
2410 'Max',3, ... | |
2411 'Min',1, ... | |
2412 'Position',[0.638888888888889 0.4333333333333333 0.1666666666666667 0.125], ... | |
2413 'String',temp3, ... | |
2414 'FontUnits','normalized',... | |
2415 'Style','popupmenu', ... | |
2416 'Tag','PopupMenu3', ... | |
2417 'Value',2); | |
2418 h1 = uicontrol('Parent',h0, ... | |
2419 'Units','normalized', ... | |
2420 'HorizontalAlignment','left', ... | |
2421 'ListboxTop',0, ... | |
2422 'Position',[0.4444444444444445 0.6 0.1666666666666667 0.125], ... | |
2423 'FontUnits','normalized',... | |
2424 'String','munits:', ... | |
2425 'Style','text', ... | |
2426 'Tag','StaticText5'); | |
2427 h1 = uicontrol('Parent',h0, ... | |
2428 'Units','normalized', ... | |
2429 'BackgroundColor',[1 1 1], ... | |
2430 'Callback','som_gui(''munits'');', ... | |
2431 'ListboxTop',0, ... | |
2432 'Position',[0.638888888888889 0.6 0.1666666666666667 0.125], ... | |
2433 'Style','edit', ... | |
2434 'FontUnits','normalized',... | |
2435 'Tag','EditText2'); | |
2436 if nargout > 0, fig = h0; end | |
2437 | |
2438 | |
2439 | |
2440 | |
2441 | |
2442 | |
2443 | |
2444 function fig = new_para2_2() | |
2445 | |
2446 temp1 = {'0';'1';'2';'3'}; | |
2447 temp2 = {'gaussian';'cutgauss';'ep';'bubble'}; | |
2448 temp3 = {'epochs';'samples'}; | |
2449 temp4 = {'random';'ordered'}; | |
2450 temp5 = {'inv';'linear';'power'}; | |
2451 | |
2452 v = version; | |
2453 ver_53_or_newer = (str2num(v(1:3)) >= 5.3); | |
2454 | |
2455 h0 = figure('Units','normalized', ... | |
2456 'Color',[0.8 0.8 0.8], ... | |
2457 'Name','Change training parameters!', ... | |
2458 'NumberTitle','off', ... | |
2459 'PaperPosition',[18 180 576 432], ... | |
2460 'PaperType','a4letter', ... | |
2461 'PaperUnits','points', ... | |
2462 'Position',[0.59140625 0.4560546875 0.3046875 0.4619140625], ... | |
2463 'Tag','Fig3'); | |
2464 if ver_53_or_newer, set(h0,'ToolBar','none'); end | |
2465 h1 = uicontrol('Parent',h0, ... | |
2466 'Units','normalized', ... | |
2467 'ListboxTop',0, ... | |
2468 'Position',[0.02051282051282051 0.08456659619450317 0.9641025641025641 0.8921775898520086], ... | |
2469 'Style','frame', ... | |
2470 'Tag','Frame1'); | |
2471 h1 = uicontrol('Parent',h0, ... | |
2472 'Units','normalized', ... | |
2473 'ListboxTop',0, ... | |
2474 'Position',[0.5308 0.1374 0.4000 0.3742], ... | |
2475 'Style','frame', ... | |
2476 'Tag','Frame3'); | |
2477 h1 = uicontrol('Parent',h0, ... | |
2478 'Units','normalized', ... | |
2479 'ListboxTop',0, ... | |
2480 'Position',[0.08012820512820512 0.1416490486257928 0.4102564102564102 0.3699788583509514], ... | |
2481 'Style','frame', ... | |
2482 'Tag','Frame2'); | |
2483 h1 = uicontrol('Parent',h0, ... | |
2484 'Units','normalized', ... | |
2485 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2486 'Callback','close(gcbf);', ... | |
2487 'ListboxTop',0, ... | |
2488 'Position',[0.6410 0.0036 0.2897 0.0740], ... | |
2489 'FontUnits','normalized',... | |
2490 'String','Cancel', ... | |
2491 'Tag','Pushbutton2'); | |
2492 h1 = uicontrol('Parent',h0, ... | |
2493 'Units','normalized', ... | |
2494 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2495 'Callback','som_gui(''set_new_parameters'');', ... | |
2496 'ListboxTop',0, ... | |
2497 'Position',[0.1026 0.0036 0.2897 0.0740], ... | |
2498 'String','Set parameters', ... | |
2499 'FontUnits','normalized',... | |
2500 'Tag','Pushbutton1'); | |
2501 h1 = uicontrol('Parent',h0, ... | |
2502 'Units','normalized', ... | |
2503 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2504 'ListboxTop',0, ... | |
2505 'Max',4, ... | |
2506 'Min',1, ... | |
2507 'Position',[0.7051282051282051 0.6723044397463003 0.1923076923076923 0.040169133192389], ... | |
2508 'String',temp1, ... | |
2509 'FontUnits','normalized',... | |
2510 'Style','popupmenu', ... | |
2511 'Tag','PopupMenu2', ... | |
2512 'Value',1); | |
2513 h1 = uicontrol('Parent',h0, ... | |
2514 'Units','normalized', ... | |
2515 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2516 'ListboxTop',0, ... | |
2517 'Max',4, ... | |
2518 'Min',1, ... | |
2519 'Position',[0.2948717948717949 0.6670190274841438 0.1923076923076923 0.03964059196617336], ... | |
2520 'String',temp2, ... | |
2521 'FontUnits','normalized',... | |
2522 'Style','popupmenu', ... | |
2523 'Tag','PopupMenu1', ... | |
2524 'Value',1); | |
2525 h1 = uicontrol('Parent',h0, ... | |
2526 'Units','normalized', ... | |
2527 'Callback','som_gui(''batch_cancel'');', ... | |
2528 'HorizontalAlignment','left', ... | |
2529 'ListboxTop',0, ... | |
2530 'Position',[0.5076923076923077 0.6575052854122622 0.1923076923076923 0.05285412262156448], ... | |
2531 'String','tracking', ... | |
2532 'FontUnits','normalized',... | |
2533 'Style','text', ... | |
2534 'Tag','StaticText6'); | |
2535 h1 = uicontrol('Parent',h0, ... | |
2536 'Units','normalized', ... | |
2537 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2538 'Callback','som_gui(''batch_cancel'');', ... | |
2539 'HorizontalAlignment','left', ... | |
2540 'ListboxTop',0, ... | |
2541 'Position',[0.09615384615384615 0.6553911205073996 0.1923076923076923 0.05285412262156448], ... | |
2542 'String','neigh.', ... | |
2543 'FontUnits','normalized',... | |
2544 'Style','text', ... | |
2545 'Tag','StaticText5'); | |
2546 h1 = uicontrol('Parent',h0, ... | |
2547 'Units','normalized', ... | |
2548 'HorizontalAlignment','left', ... | |
2549 'ListboxTop',0, ... | |
2550 'Position',[0.09615384615384615 0.7526427061310783 0.09487179487179487 0.04228329809725159], ... | |
2551 'String','mask:', ... | |
2552 'FontUnits','normalized',... | |
2553 'Style','text', ... | |
2554 'Tag','StaticText2'); | |
2555 h1 = uicontrol('Parent',h0, ... | |
2556 'Units','normalized', ... | |
2557 'BackgroundColor',[1 1 1], ... | |
2558 'Position',[0.2948717948717949 0.7399577167019028 0.6025641025641025 0.07399577167019028], ... | |
2559 'String',' ', ... | |
2560 'FontUnits','normalized',... | |
2561 'Style','listbox', ... | |
2562 'Tag','Listbox2', ... | |
2563 'Value',1); | |
2564 h1 = uicontrol('Parent',h0, ... | |
2565 'Units','normalized', ... | |
2566 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2567 'HorizontalAlignment','left', ... | |
2568 'ListboxTop',0, ... | |
2569 'Position',[0.0962 0.8060 0.1154 0.0529], ... | |
2570 'FontUnits','normalized',... | |
2571 'String','Set', ... | |
2572 'Style','text', ... | |
2573 'Tag','StaticText3'); | |
2574 h1 = uicontrol('Parent',h0, ... | |
2575 'Units','normalized', ... | |
2576 'BackgroundColor',[1 1 1], ... | |
2577 'Callback','som_gui(''set_batch_mask'');', ... | |
2578 'Position',[0.2948717948717949 0.8165961945031712 0.3205128205128205 0.05285412262156448], ... | |
2579 'String',' ', ... | |
2580 'FontUnits','normalized',... | |
2581 'Style','listbox', ... | |
2582 'Tag','Listbox1', ... | |
2583 'Value',1); | |
2584 h1 = uicontrol('Parent',h0, ... | |
2585 'Units','normalized', ... | |
2586 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2587 'HorizontalAlignment','left', ... | |
2588 'ListboxTop',0, ... | |
2589 'Position',[0.6250 0.8060 0.1603 0.0529], ... | |
2590 'String','to value', ... | |
2591 'FontUnits','normalized',... | |
2592 'Style','text', ... | |
2593 'Tag','StaticText4'); | |
2594 h1 = uicontrol('Parent',h0, ... | |
2595 'Units','normalized', ... | |
2596 'BackgroundColor',[1 1 1], ... | |
2597 'Callback','som_gui(''set_batch_mask'');', ... | |
2598 'ListboxTop',0, ... | |
2599 'Position',[0.7923076923076923 0.8181818181818182 0.09487179487179487 0.05285412262156448], ... | |
2600 'Style','edit', ... | |
2601 'FontUnits','normalized',... | |
2602 'Tag','EditText2'); | |
2603 h1 = uicontrol('Parent',h0, ... | |
2604 'Units','normalized', ... | |
2605 'BackgroundColor',[1 1 1], ... | |
2606 'Callback','som_gui(''check_fine_trainlen'');', ... | |
2607 'ListboxTop',0, ... | |
2608 'Position',[0.7923 0.2352 0.0974 0.0402], ... | |
2609 'FontUnits','normalized',... | |
2610 'Style','edit', ... | |
2611 'Tag','EditText11'); | |
2612 h1 = uicontrol('Parent',h0, ... | |
2613 'Units','normalized', ... | |
2614 'BackgroundColor',[1 1 1], ... | |
2615 'Callback','som_gui(''check_fine_alphaini'');', ... | |
2616 'Enable','off', ... | |
2617 'ListboxTop',0, ... | |
2618 'Position',[0.7923076923076923 0.1664904862579281 0.09743589743589742 0.03805496828752643], ... | |
2619 'Style','edit', ... | |
2620 'FontUnits','normalized',... | |
2621 'Tag','EditText10', ... | |
2622 'Visible','off'); | |
2623 h1 = uicontrol('Parent',h0, ... | |
2624 'Units','normalized', ... | |
2625 'BackgroundColor',[1 1 1], ... | |
2626 'Callback','som_gui(''check_fine_radfin'');', ... | |
2627 'ListboxTop',0, ... | |
2628 'Position',[0.7923076923076923 0.3002114164904862 0.09743589743589742 0.040169133192389], ... | |
2629 'Style','edit', ... | |
2630 'FontUnits','normalized',... | |
2631 'Tag','EditText9'); | |
2632 h1 = uicontrol('Parent',h0, ... | |
2633 'Units','normalized', ... | |
2634 'BackgroundColor',[1 1 1], ... | |
2635 'Callback','som_gui(''check_fine_radini'');', ... | |
2636 'ListboxTop',0, ... | |
2637 'Position',[0.7923076923076923 0.3657505285412262 0.09743589743589742 0.040169133192389], ... | |
2638 'Style','edit', ... | |
2639 'FontUnits','normalized',... | |
2640 'Tag','EditText8'); | |
2641 h1 = uicontrol('Parent',h0, ... | |
2642 'Units','normalized', ... | |
2643 'BackgroundColor',[0.8 0.8 0.8], ... | |
2644 'HorizontalAlignment','left', ... | |
2645 'ListboxTop',0, ... | |
2646 'Position',[0.5590 0.2326 0.2179 0.0402], ... | |
2647 'String','training length', ... | |
2648 'FontUnits','normalized',... | |
2649 'Style','text', ... | |
2650 'Tag','StaticText16'); | |
2651 h1 = uicontrol('Parent',h0, ... | |
2652 'Units','normalized', ... | |
2653 'BackgroundColor',[0.8 0.8 0.8], ... | |
2654 'HorizontalAlignment','left', ... | |
2655 'ListboxTop',0, ... | |
2656 'Position',[0.5590 0.1665 0.2179 0.0381], ... | |
2657 'String','alpha initial', ... | |
2658 'FontUnits','normalized',... | |
2659 'Style','text', ... | |
2660 'Tag','StaticText14', ... | |
2661 'Visible','off'); | |
2662 h1 = uicontrol('Parent',h0, ... | |
2663 'Units','normalized', ... | |
2664 'BackgroundColor',[0.8 0.8 0.8], ... | |
2665 'HorizontalAlignment','left', ... | |
2666 'ListboxTop',0, ... | |
2667 'Position',[0.5590 0.2981 0.2179 0.0402], ... | |
2668 'String','radius final', ... | |
2669 'FontUnits','normalized',... | |
2670 'Style','text', ... | |
2671 'Tag','StaticText12'); | |
2672 h1 = uicontrol('Parent',h0, ... | |
2673 'Units','normalized', ... | |
2674 'BackgroundColor',[0.8 0.8 0.8], ... | |
2675 'HorizontalAlignment','left', ... | |
2676 'ListboxTop',0, ... | |
2677 'Position',[0.5590 0.3636 0.2179 0.0402], ... | |
2678 'String','radius initial', ... | |
2679 'FontUnits','normalized',... | |
2680 'Style','text', ... | |
2681 'Tag','StaticText10'); | |
2682 h1 = uicontrol('Parent',h0, ... | |
2683 'Units','normalized', ... | |
2684 'BackgroundColor',[1 1 1], ... | |
2685 'Callback','som_gui(''check_rough_trainlen'');', ... | |
2686 'ListboxTop',0, ... | |
2687 'Position',[0.3590 0.2352 0.0949 0.0402], ... | |
2688 'Style','edit', ... | |
2689 'FontUnits','normalized',... | |
2690 'Tag','EditText7'); | |
2691 h1 = uicontrol('Parent',h0, ... | |
2692 'Units','normalized', ... | |
2693 'BackgroundColor',[1 1 1], ... | |
2694 'Callback','som_gui(''check_rough_alphaini'');', ... | |
2695 'Enable','off', ... | |
2696 'ListboxTop',0, ... | |
2697 'Position',[0.3590 0.1691 0.0949 0.0381], ... | |
2698 'Style','edit', ... | |
2699 'FontUnits','normalized',... | |
2700 'Tag','EditText6', ... | |
2701 'Visible','off'); | |
2702 h1 = uicontrol('Parent',h0, ... | |
2703 'Units','normalized', ... | |
2704 'BackgroundColor',[1 1 1], ... | |
2705 'Callback','som_gui(''check_rough_radfin'');', ... | |
2706 'ListboxTop',0, ... | |
2707 'Position',[0.358974358974359 0.3044397463002114 0.09487179487179487 0.040169133192389], ... | |
2708 'Style','edit', ... | |
2709 'FontUnits','normalized',... | |
2710 'Tag','EditText5'); | |
2711 h1 = uicontrol('Parent',h0, ... | |
2712 'Units','normalized', ... | |
2713 'BackgroundColor',[1 1 1], ... | |
2714 'Callback','som_gui(''check_rough_radini'');', ... | |
2715 'ListboxTop',0, ... | |
2716 'Position',[0.358974358974359 0.3699788583509514 0.09487179487179487 0.040169133192389], ... | |
2717 'Style','edit', ... | |
2718 'FontUnits','normalized',... | |
2719 'Tag','EditText4'); | |
2720 h1 = uicontrol('Parent',h0, ... | |
2721 'Units','normalized', ... | |
2722 'BackgroundColor',[0.8 0.8 0.8], ... | |
2723 'HorizontalAlignment','left', ... | |
2724 'ListboxTop',0, ... | |
2725 'Position',[0.0962 0.2326 0.2179 0.0402], ... | |
2726 'String','training length', ... | |
2727 'FontUnits','normalized',... | |
2728 'Style','text', ... | |
2729 'Tag','StaticText15'); | |
2730 h1 = uicontrol('Parent',h0, ... | |
2731 'Units','normalized', ... | |
2732 'BackgroundColor',[0.8 0.8 0.8], ... | |
2733 'HorizontalAlignment','left', ... | |
2734 'ListboxTop',0, ... | |
2735 'Position',[0.0962 0.1691 0.2179 0.0381], ... | |
2736 'String','alpha initial', ... | |
2737 'FontUnits','normalized',... | |
2738 'Style','text', ... | |
2739 'Tag','StaticText13', ... | |
2740 'Visible','off'); | |
2741 h1 = uicontrol('Parent',h0, ... | |
2742 'Units','normalized', ... | |
2743 'BackgroundColor',[0.8 0.8 0.8], ... | |
2744 'HorizontalAlignment','left', ... | |
2745 'ListboxTop',0, ... | |
2746 'Position',[0.0962 0.3023 0.2179 0.0402], ... | |
2747 'String','radius final', ... | |
2748 'FontUnits','normalized',... | |
2749 'Style','text', ... | |
2750 'Tag','StaticText11'); | |
2751 h1 = uicontrol('Parent',h0, ... | |
2752 'Units','normalized', ... | |
2753 'BackgroundColor',[0.8 0.8 0.8], ... | |
2754 'HorizontalAlignment','left', ... | |
2755 'ListboxTop',0, ... | |
2756 'Position',[0.0962 0.3679 0.2179 0.0402], ... | |
2757 'FontUnits','normalized',... | |
2758 'String','radius initial', ... | |
2759 'Style','text', ... | |
2760 'Tag','StaticText9'); | |
2761 h1 = uicontrol('Parent',h0, ... | |
2762 'Units','normalized', ... | |
2763 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2764 'ListboxTop',0, ... | |
2765 'Position',[0.5948717948717949 0.4291754756871036 0.2871794871794872 0.05285412262156448], ... | |
2766 'String','Finetune', ... | |
2767 'FontUnits','normalized',... | |
2768 'Style','text', ... | |
2769 'Tag','StaticText8'); | |
2770 h1 = uicontrol('Parent',h0, ... | |
2771 'Units','normalized', ... | |
2772 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2773 'ListboxTop',0, ... | |
2774 'Position',[0.1205128205128205 0.4355179704016914 0.3153846153846154 0.04862579281183932], ... | |
2775 'String','Rough', ... | |
2776 'FontUnits','normalized',... | |
2777 'Style','text', ... | |
2778 'Tag','StaticText7'); | |
2779 h1 = uicontrol('Parent',h0, ... | |
2780 'Units','normalized', ... | |
2781 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2782 'FontWeight','bold', ... | |
2783 'ListboxTop',0, ... | |
2784 'Position',[0.1641025641025641 0.8900634249471459 0.7025641025641025 0.05285412262156448], ... | |
2785 'String','Change parameters for batch training', ... | |
2786 'Style','text', ... | |
2787 'FontUnits','normalized',... | |
2788 'Tag','StaticText1'); | |
2789 h1 = uicontrol('Parent',h0, ... | |
2790 'Units','normalized', ... | |
2791 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2792 'HorizontalAlignment','left', ... | |
2793 'ListboxTop',0, ... | |
2794 'Position',[0.09615384615384615 0.6025369978858351 0.1743589743589744 0.040169133192389], ... | |
2795 'String','length type:', ... | |
2796 'Style','text', ... | |
2797 'FontUnits','normalized',... | |
2798 'Tag','StaticText17'); | |
2799 h1 = uicontrol('Parent',h0, ... | |
2800 'Units','normalized', ... | |
2801 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2802 'ListboxTop',0, ... | |
2803 'Max',2, ... | |
2804 'Min',1, ... | |
2805 'Position',[0.2948717948717949 0.6062367864693446 0.1923076923076923 0.03964059196617336], ... | |
2806 'String',temp3, ... | |
2807 'FontUnits','normalized',... | |
2808 'Style','popupmenu', ... | |
2809 'Tag','PopupMenu3', ... | |
2810 'Value',1); | |
2811 h1 = uicontrol('Parent',h0, ... | |
2812 'Units','normalized', ... | |
2813 'HorizontalAlignment','left', ... | |
2814 'ListboxTop',0, ... | |
2815 'Position',[0.5102564102564102 0.6004228329809724 0.1641025641025641 0.040169133192389], ... | |
2816 'String','order', ... | |
2817 'FontUnits','normalized',... | |
2818 'Style','text', ... | |
2819 'Tag','StaticText18'); | |
2820 h1 = uicontrol('Parent',h0, ... | |
2821 'Units','normalized', ... | |
2822 'HorizontalAlignment','left', ... | |
2823 'ListboxTop',0, ... | |
2824 'Max',2, ... | |
2825 'Min',1, ... | |
2826 'Position',[0.7051282051282051 0.6109936575052853 0.1923076923076923 0.040169133192389], ... | |
2827 'String',temp4, ... | |
2828 'FontUnits','normalized',... | |
2829 'Style','popupmenu', ... | |
2830 'Tag','PopupMenu4', ... | |
2831 'Value',1); | |
2832 h1 = uicontrol('Parent',h0, ... | |
2833 'Units','normalized', ... | |
2834 'HorizontalAlignment','left', ... | |
2835 'ListboxTop',0, ... | |
2836 'Position',[0.09615384615384615 0.5369978858350951 0.2051282051282051 0.040169133192389], ... | |
2837 'String','learning func', ... | |
2838 'FontUnits','normalized',... | |
2839 'Style','text', ... | |
2840 'Tag','StaticText19'); | |
2841 h1 = uicontrol('Parent',h0, ... | |
2842 'Units','normalized', ... | |
2843 'BackgroundColor',[0.701960784313725 0.701960784313725 0.701960784313725], ... | |
2844 'ListboxTop',0, ... | |
2845 'Max',3, ... | |
2846 'Min',1, ... | |
2847 'Position',[0.2948717948717949 0.5454545454545455 0.1923076923076923 0.03964059196617336], ... | |
2848 'String',temp5, ... | |
2849 'FontUnits','normalized',... | |
2850 'Style','popupmenu', ... | |
2851 'Tag','PopupMenu5', ... | |
2852 'Value',1); | |
2853 if nargout > 0, fig = h0; end | |
2854 | |
2855 | |
2856 function print_info(sS,level,fid) | |
2857 | |
2858 | |
2859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2860 %% check arguments | |
2861 | |
2862 | |
2863 %error(nargchk(1, 2, nargin)) % check no. of input args is correct | |
2864 | |
2865 if ~isstruct(sS), | |
2866 if ~iscell(sS) | ~isstruct(sS{1}), | |
2867 error('Input argument is not a struct or a cell array of structs.') | |
2868 end | |
2869 csS = sS; | |
2870 else | |
2871 csS = {sS}; | |
2872 end | |
2873 | |
2874 if nargin<2 | isempty(level) | isnan(level), level = 1; end | |
2875 | |
2876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
2877 %% print struct information | |
2878 | |
2879 for c=1:length(csS), | |
2880 sS = csS{c}; | |
2881 | |
2882 switch sS.type, | |
2883 case 'som_map', | |
2884 mdim = length(sS.topol.msize); | |
2885 [munits dim] = size(sS.codebook); | |
2886 t = length(sS.trainhist); | |
2887 if t==0, st='uninitialized'; | |
2888 elseif t==1, st = 'initialized'; | |
2889 else st = sprintf('initialized, trained %d times',t-1); | |
2890 end | |
2891 | |
2892 % level 1 | |
2893 fprintf(fid,'%% Struct type : %s\n', sS.type); | |
2894 fprintf(fid,'%% Map name : %s\n', sS.name); | |
2895 fprintf(fid,'%% Input dimension : %d\n', dim); | |
2896 fprintf(fid,'%% Map grid size : '); | |
2897 for i = 1:mdim - 1, fprintf(fid,'%d x ',sS.topol.msize(i)); end | |
2898 fprintf(fid,'%d\n', sS.topol.msize(mdim)); | |
2899 fprintf(fid,'%% Lattice type (rect/hexa) : %s\n', sS.topol.lattice); | |
2900 fprintf(fid,'%% Shape (sheet/cyl/toroid) : %s\n', sS.topol.shape); | |
2901 fprintf(fid,'%% Neighborhood type : %s\n', sS.neigh); | |
2902 fprintf(fid,'%% Mask : '); | |
2903 if dim, | |
2904 for i = 1:dim-1, fprintf(fid,'%d ',sS.mask(i)); end; | |
2905 fprintf(fid,'%d\n',sS.mask(dim)); | |
2906 else fprintf(fid,'%% \n'); | |
2907 end | |
2908 fprintf(fid,'%% Training status : %s\n', st); | |
2909 | |
2910 % level 1, | |
2911 status = cell(dim,1); | |
2912 for i=1:dim, | |
2913 n = length(sS.comp_norm{i}); | |
2914 if n, | |
2915 uninit = strcmp('uninit',{sS.comp_norm{i}.status}); | |
2916 done = strcmp('done',{sS.comp_norm{i}.status}); | |
2917 undone = strcmp('undone',{sS.comp_norm{i}.status}); | |
2918 if sum(uninit)==n, status{i} = 'no normalization'; | |
2919 elseif sum(done)==n, status{i} = 'normalized'; | |
2920 elseif sum(undone)==n, status{i} = 'denormalized'; | |
2921 else status{i} = 'partial'; | |
2922 end | |
2923 else status{i} = 'no normalization'; end | |
2924 end | |
2925 if level>1, | |
2926 fprintf(fid,'%% Vector components\n'); | |
2927 M = sS.codebook; | |
2928 fprintf(fid,'%% # name mask min mean max std status\n'); | |
2929 fprintf(fid,'%% --- ------------ ---- ------ ------ ------ ------ ------\n'); | |
2930 for i = 1:dim, | |
2931 fprintf(fid,'%% %-3d %-12s %-4.2f %6.1g %6.1g %6.1g %6.1g %s\n', ... | |
2932 i,sS.comp_names{i}, sS.mask(i), ... | |
2933 min(M(:,i)),mean(M(:,i)),max(M(:,i)),std(M(:,i)),status{i}); | |
2934 end | |
2935 end | |
2936 | |
2937 % level 3 | |
2938 if level>2, | |
2939 fprintf(fid,'%% Vector component normalizations\n'); | |
2940 fprintf(fid,'%% # name method (i=uninit,u=undone,d=done)\n'); | |
2941 fprintf(fid,'%% --- ------------ ---------------------------------------\n'); | |
2942 for i=1:dim, | |
2943 fprintf(fid,'%% %-3d %-12s ',i,sS.comp_names{i}); | |
2944 n = length(sS.comp_norm{i}); | |
2945 for j=1:n, | |
2946 m = sS.comp_norm{i}(j).method; | |
2947 s = sS.comp_norm{i}(j).status; | |
2948 if strcmp(s,'uninit'), c='i'; | |
2949 elseif strcmp(s,'undone'), c='u'; | |
2950 else c='d'; | |
2951 end | |
2952 fprintf(fid,'%% %s[%s] ',m,c); | |
2953 end | |
2954 fprintf(fid,'%% \n'); | |
2955 end | |
2956 end | |
2957 | |
2958 % level 4 | |
2959 if level>3, | |
2960 fprintf(fid,'%% Training history\n'); | |
2961 for i=1:t, | |
2962 sT = sS.trainhist(i); | |
2963 fprintf(fid,'%% * Algorithm: %8s Data: %13s Trainlen: %8d\n',... | |
2964 sT.algorithm,sT.data_name,sT.trainlen); | |
2965 %if i>1, | |
2966 fprintf(fid,'%% Neighborh: %8s Mask: ',sT.neigh); | |
2967 for i = 1:dim-1, fprintf(fid,'%% %d ',sT.mask(i)); end; | |
2968 fprintf(fid,'%% %d\n',sT.mask(mdim)); | |
2969 fprintf(fid,'%% Radius: %4.2f->%4.2f Alpha: %5.3f (%s)\n', ... | |
2970 sT.radius_ini,sT.radius_fin,sT.alpha_ini,sT.alpha_type); | |
2971 %end | |
2972 fprintf(fid,'%% Time: %s\n',sT.time); | |
2973 end | |
2974 end | |
2975 | |
2976 case 'som_data', | |
2977 | |
2978 [dlen dim] = size(sS.data); | |
2979 if dlen*dim | |
2980 ind = find(~isnan(sum(sS.data),2)); | |
2981 else ind = []; end | |
2982 complete = size(sS.data(ind,:),1); | |
2983 partial = dlen - complete; | |
2984 values = prod(size(sS.data)); | |
2985 missing = sum(sum(isnan(sS.data))); | |
2986 | |
2987 % level 1 | |
2988 fprintf(fid,'%% Struct type : %s\n', sS.type); | |
2989 fprintf(fid,'%% Data name : %s\n', sS.name); | |
2990 fprintf(fid,'%% Vector dimension : %d\n', dim); | |
2991 fprintf(fid,'%% Number of data vectors : %d\n', dlen); | |
2992 fprintf(fid,'%% Complete data vectors : %d\n', complete); | |
2993 fprintf(fid,'%% Partial data vectors : %d\n', partial); | |
2994 if values, r = floor(100 * (values - missing) / values); else r = 0; end | |
2995 fprintf(fid,'%% Complete values : %d of %d (%d%%)\n', ... | |
2996 values-missing, values, r); | |
2997 | |
2998 % level 2, | |
2999 status = cell(dim,1); | |
3000 for i=1:dim, | |
3001 n = length(sS.comp_norm{i}); | |
3002 if n, | |
3003 uninit = strcmp('uninit',{sS.comp_norm{i}.status}); | |
3004 done = strcmp('done',{sS.comp_norm{i}.status}); | |
3005 undone = strcmp('undone',{sS.comp_norm{i}.status}); | |
3006 if sum(uninit)==n, status{i} = 'no normalization'; | |
3007 elseif sum(done)==n, status{i} = 'normalized'; | |
3008 elseif sum(undone)==n, status{i} = 'denormalized'; | |
3009 else status{i} = 'partial'; | |
3010 end | |
3011 else status{i} = 'no normalization'; end | |
3012 end | |
3013 if level>1, | |
3014 fprintf(fid,'%% Vector components\n'); | |
3015 D = sS.data; | |
3016 fprintf(fid,'%% # name min mean max std missing status\n'); | |
3017 fprintf(fid,'%% --- ------------ ------ ------ ------ ------ ----------- ------\n'); | |
3018 for i = 1:dim, | |
3019 known = find(~isnan(D(:,i))); | |
3020 miss = dlen-length(known); | |
3021 fprintf(fid,'%% %-3d %-12s %6.1g %6.1g %6.1g %6.1g %5d (%2d%%) %s\n', ... | |
3022 i,sS.comp_names{i}, ... | |
3023 min(D(known,i)),mean(D(known,i)),max(D(known,i)),std(D(known,i)), ... | |
3024 miss,floor(100*miss/dlen),status{i}); | |
3025 end | |
3026 end | |
3027 | |
3028 % level 3 | |
3029 if level>2, | |
3030 fprintf(fid,'%% Vector component normalizations\n'); | |
3031 fprintf(fid,'%% # name method (i=uninit,u=undone,d=done)\n'); | |
3032 fprintf(fid,'%% --- ------------ ---------------------------------------\n'); | |
3033 for i=1:dim, | |
3034 fprintf(fid,'%% %-3d %-12s ',i,sS.comp_names{i}); | |
3035 n = length(sS.comp_norm{i}); | |
3036 for j=1:n, | |
3037 m = sS.comp_norm{i}(j).method; | |
3038 s = sS.comp_norm{i}(j).status; | |
3039 if strcmp(s,'uninit'), c='i'; | |
3040 elseif strcmp(s,'undone'), c='u'; | |
3041 else c='d'; | |
3042 end | |
3043 fprintf(fid,'%% %s[%s] ',m,c); | |
3044 end | |
3045 fprintf(fid,'%% \n'); | |
3046 end | |
3047 end | |
3048 | |
3049 case 'som_topol', | |
3050 | |
3051 mdim = length(sS.msize); | |
3052 | |
3053 % level 1 | |
3054 fprintf(fid,'%% Struct type : %s\n',sS.type); | |
3055 fprintf(fid,'%% Map grid size : '); | |
3056 for i = 1:mdim - 1, fprintf(fid,'%% %d x ',sS.msize(i)); end | |
3057 fprintf(fid,'%% %d\n', sS.msize(mdim)); | |
3058 fprintf(fid,'%% Lattice type (rect/hexa) : %s\n', sS.lattice); | |
3059 fprintf(fid,'%% Shape (sheet/cyl/toroid) : %s\n', sS.shape); | |
3060 | |
3061 case 'som_train', | |
3062 | |
3063 % level 1 | |
3064 fprintf(fid,'%% Struct type : %s\n',sS.type); | |
3065 fprintf(fid,'%% Training algorithm : %s\n',sS.algorithm); | |
3066 fprintf(fid,'%% Training data : %s\n',sS.data_name); | |
3067 fprintf(fid,'%% Neighborhood function : %s\n',sS.neigh); | |
3068 fprintf(fid,'%% Mask : '); | |
3069 dim = length(sS.mask); | |
3070 if dim, | |
3071 for i = 1:dim-1, fprintf(fid,'%% %d ',sS.mask(i)); end; | |
3072 fprintf(fid,'%% %d\n',sS.mask(end)); | |
3073 else fprintf(fid,'%% \n'); end | |
3074 fprintf(fid,'%% Initial radius : %-6.1f\n',sS.radius_ini); | |
3075 fprintf(fid,'%% Final radius : %-6.1f\n',sS.radius_fin); | |
3076 fprintf(fid,'%% Initial learning rate (alpha) : %-6.1f\n',sS.alpha_ini); | |
3077 fprintf(fid,'%% Alpha function type (linear/inv) : %s\n',sS.alpha_type); | |
3078 fprintf(fid,'%% Training length : %d\n',sS.trainlen); | |
3079 fprintf(fid,'%% Average quantization error : %-6.1f\n',sS.qerror); | |
3080 fprintf(fid,'%% When training was done : %s\n',sS.time); | |
3081 | |
3082 case 'som_norm', | |
3083 | |
3084 % level 1 | |
3085 fprintf(fid,'%% Struct type : %s\n',sS.type); | |
3086 fprintf(fid,'%% Normalization method : %s\n',sS.method); | |
3087 fprintf(fid,'%% Status : %s\n',sS.status); | |
3088 | |
3089 % level 2 | |
3090 if level>1, | |
3091 fprintf(fid,'%% Parameters:\n'); | |
3092 sS.params | |
3093 end | |
3094 end | |
3095 end | |
3096 | |
3097 function [] = html2tex(html_addres,texfile) | |
3098 | |
3099 tempfile = tempname; | |
3100 fid = fopen(texfile,'w'); | |
3101 eval(['!lynx -dump ' html_addres ' > ' tempfile]); | |
3102 fid2 = fopen(tempfile,'r'); | |
3103 while not(feof(fid2)) | |
3104 line = fgets(fid2); | |
3105 line = strcat('%',line); | |
3106 fprintf(fid,'%s',line); | |
3107 end | |
3108 fclose(fid); | |
3109 fclose(fid2); | |
3110 delete (tempfile); | |
3111 | |
3112 | |
3113 function [name] = retname | |
3114 resnames = who; | |
3115 if size(resnames,1) > 0 | |
3116 max_length = size(resnames{1},2); | |
3117 for index = 1:size(resnames,1) | |
3118 if size(resnames{index},2) > max_length | |
3119 max_length = size(resnames{index},2); | |
3120 end | |
3121 end | |
3122 length = max_length + 1; | |
3123 name(:,1:1:length) = 'A' | |
3124 else | |
3125 name = 'A'; | |
3126 end | |
3127 %% | |
3128 | |
3129 | |
3130 |