comparison toolboxes/MIRtoolbox1.3.2/somtoolbox/vis_show_gui_tool.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 r=vis_show_gui_tool(h,action,varargin)
2
3 %VIS_SHOW_GUI_TOOL is a subfunction of SOM_SHOW_GUI.
4 %
5 % r = vis_show_gui_tool(handle, action, varargin)
6 %
7 % Input arguments:
8 % handle (struct)
9 % action (string)
10 % varargin (varies)
11 %
12 % See also SOM_SHOW_GUI.
13
14 % Copyright (c) 2000 by Roman Feldman and Juha Vesanto
15 % Contributed to SOM Toolbox on August 22nd, 2000
16 % http://www.cis.hut.fi/projects/somtoolbox/
17
18 % Version 2.0beta roman 160800 juuso 220800
19
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 if ishandle(h(1)),
23 udata = get(h(1),'UserData');
24 if isfield(udata,'plot_array'),
25 plot_array = udata.plot_array;
26 if isfield(udata,'vis_h')
27 % get most recent plotted
28 children = get(0,'children');
29 % first refresh plot info
30 udata.vis_h = setdiff(udata.vis_h,setdiff(udata.vis_h,children));
31 set(h(1),'userdata',udata);
32 for i=1:length(children),
33 if any(children(i)==udata.vis_h),
34 child = children(i);
35 [handles,msg,lattice,msize,dim]=vis_som_show_data('all',children(i));
36 break;
37 elseif i==length(children),
38 errordlg({'Plot not found', ...
39 'Try to visualize first'},'Error in SOM_VIS: tools');
40 return;
41 end
42 end
43 else
44 errordlg({'Plot not found', ...
45 'Try to visualize first'},'Error in SOM_VIS: tools');
46 return;
47 end
48 end
49 end
50
51 %--- color vars ---
52 fig_color = [0.8 0.8 0.8];
53 bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725];
54 bg_color2 = [0.9 0.9 0.9];
55 %--- object position vars (in pixels) ---
56 % calculations based on case 'comp'
57 %% hint text
58 hint_dist1 = 98.17-(61.27+36.9); % hint text lower edge and next lower frame upper edge
59 hint_dist2 = 123-(98.17+18.45); % figure upper edge and hint text upper edge
60 %% general
61 dist1 = 67.42-61.27; % general distance between frame edge and object in frame
62 %% frame + ok / cancel
63 frames_dist = 61.27-(8.38+36.9);
64 frames_dist2 = 8.38;
65 f_fr = [7.9 8.38 216.2 36.9]; % final frame
66 ok_pb = [17.1 15.76 75.9 22.14];
67 cancel_pb = [139 15.76 75.9 22.14];
68 %% objects
69 hint_txt = [460 18.45]; % hint text width and height
70 interp_cb = [98.9 24.6];
71 title_txt = [90 hint_txt(2)-3];
72 title_edit_h = 23.083;
73 var_pop = [interp_cb(1) ok_pb(4)];
74 list_lt = [130 130];
75 calc_txt = [list_lt(1) hint_txt(2)];
76 selvar_pb = [110 ok_pb(4)];
77 strd_ed = [var_pop(1) title_edit_h];
78 radio_rb = selvar_pb;
79
80 %%%%%%%%%%%
81 % add_label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %%%%%%%%%%%
83 if strcmp(action,'add_label')
84 old_fig_n = watchon;
85 W = 345.4; H = 222.769;
86 o21 = zeros(1,4);
87 o21(1) = (W-f_fr(3))/2;
88 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
89 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
90 hint_txt = [W 18.45]; % hint text width and height
91 units = get(h,'units');
92 set(h,'units','pixels');
93 fp = get(h,'Position');
94 fig_pos = [(fp(1)+fp(3)) ...
95 (fp(2)+fp(2)+fp(4)/2-H/2) ...
96 W ...
97 H];
98 o1 = sum(f_fr([2 4]))+frames_dist;
99 o2 = 4*dist1+2*max([title_edit_h,title_txt(2)]) ...
100 +max([title_txt(2),var_pop(2)]);
101 o6 = max([title_txt(2),var_pop(2)]);
102 o7 = max([title_txt(2),title_edit_h]);
103 o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
104 o3 = o1+0.5*o6+dist1-title_txt(2)/2;
105 o4 = o1+0.5*o6+dist1-var_pop(2)/2;
106 o5 = ok_pb(1)+title_txt(1);
107 o9 = o1+o6+0.5*o7+2*dist1-title_txt(2)/2;
108 o10 = o1+o6+0.5*o7+2*dist1-title_edit_h/2;;
109 o11 = o1+o6+o7+0.5*o8+3*dist1-title_txt(2)/2;
110 o12 = o1+o6+o7+0.5*o8+3*dist1-title_edit_h/2;
111 o13 = o1+o6+o7+0.5*o8+3*dist1-selvar_pb(2)/2;
112 o15 = o1+o2+frames_dist2;
113 o16 = 2*dist1+o7;
114 o17 = o5+strd_ed(1)+2*dist1; % W-ok_pb(1)-selvar_pb(1);
115 o18 = o15+0.5*o7+dist1-title_txt(2)/2;
116 o19 = o15+0.5*o7+dist1-title_edit_h/2;
117 o20 = o15+o16+hint_dist1;
118 hint_text_pos = [1 o20 hint_txt];
119 frame1_pos = [f_fr(1) o15 f_fr(3) o16];
120 subplots_text_pos = [ok_pb(1) o18 title_txt];
121 subplots_pos = [o5 o19 strd_ed];
122 frame2_pos = [f_fr(1) o1 f_fr(3) o2];
123 labels_text_pos = [ok_pb(1) o11 title_txt];
124 labels_pos = [o5 o12 strd_ed];
125 sel_var_pos = [o17 o13 selvar_pb];
126 text_size_text_pos = [ok_pb(1) o9 title_txt];
127 text_size_pos = [o5 o10 strd_ed];
128 text_color_text_pos = [ok_pb(1) o3 title_txt];
129 text_color_pos = [o5 o4 var_pop];
130 f_fr = [7.9 8.38 216.2 36.9]; % final frame
131 cancel_pb = [139 15.76 75.9 22.14];
132 frame3_pos = f_fr+o21;
133 ok_pos = ok_pb+o21;
134 cancel_pos = cancel_pb+o21;
135
136 fig_h = figure( ...
137 'Units','pixels', ...
138 'Position', fig_pos, ...
139 'Color',fig_color, ...
140 'NumberTitle','off', ...
141 'Name','add label', ...
142 'MenuBar','none', ...
143 'Visible','off');
144
145 set( ...
146 uicontrol( ... %% hint
147 'Units','pixels', ...
148 'BackgroundColor',fig_color, ...
149 'HorizontalAlignment','center', ...
150 'Position',hint_text_pos, ...
151 'String','Options for adding labels', ...
152 'Style','text'),'units','normalized');
153
154 set( ...
155 uicontrol( ... %% [frame]
156 'Units','pixels', ...
157 'Position',frame1_pos, ...
158 'Style','frame'),'units','normalized');
159
160 set( ...
161 uicontrol( ... %% To subplot(s)
162 'Units','pixels', ...
163 'Position',subplots_text_pos, ...
164 'HorizontalAlignment','left', ...
165 'String','To subplot(s)', ...
166 'Style','text'),'units','normalized');
167
168 ed1_h = uicontrol( ... %% [edit]
169 'Units','pixels', ...
170 'BackgroundColor',bg_color2, ...
171 'Position',subplots_pos, ...
172 'FontSize',12, ...
173 'Style','edit');
174 set(ed1_h,'units','normalized');
175
176 set( ...
177 uicontrol( ... %% [frame]
178 'Units','pixels', ...
179 'Position',frame2_pos, ...
180 'Style','frame'),'units','normalized');
181
182 set( ...
183 uicontrol( ... %% Labels
184 'Units','pixels', ...
185 'Position',labels_text_pos, ...
186 'HorizontalAlignment','left', ...
187 'String','Labels', ...
188 'Style','text'),'units','normalized');
189
190 ed2_h = uicontrol( ... %% [edit]
191 'Units','pixels', ...
192 'BackgroundColor',bg_color2, ...
193 'Position',labels_pos, ...
194 'FontSize',12, ...
195 'Style','edit');
196 set(ed2_h,'units','normalized');
197
198 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
199 'vis_show_gui_tool(tmp(2),''select'')'];
200 set( ...
201 uicontrol( ... %% Select variable
202 'Units','pixels', ...
203 'Position',sel_var_pos, ...
204 'String','Select variable', ...
205 'Callback',s),'units','normalized');
206
207 set( ...
208 uicontrol( ... %% Text size
209 'Units','pixels', ...
210 'Position',text_size_text_pos, ...
211 'HorizontalAlignment','left', ...
212 'String','Text size', ...
213 'Style','text'),'units','normalized');
214
215 ed3_h = uicontrol( ... %% [edit]
216 'Units','pixels', ...
217 'BackgroundColor',bg_color2, ...
218 'Position',text_size_pos, ...
219 'String','10', ...
220 'FontSize',12, ...
221 'Style','edit');
222 set(ed3_h,'units','normalized');
223
224 set( ...
225 uicontrol( ... %% Text color
226 'Units','pixels', ...
227 'Position',text_color_text_pos, ...
228 'HorizontalAlignment','left', ...
229 'String','Text color', ...
230 'Style','text'),'units','normalized');
231
232 ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor' 'none'};
233 s = {'black' 'white' 'yellow' 'magenta' 'cyan' 'red' 'green' ...
234 'blue' 'xor' 'none'};
235 p_h = uicontrol( ... %% [popupmenu]
236 'Units','pixels', ...
237 'Position',text_color_pos, ...
238 'UserData',ud, ...
239 'String',s, ...
240 'Style','popupmenu');
241 set(p_h,'units','normalized');
242
243 set( ...
244 uicontrol( ... %% [frame]
245 'Units','pixels', ...
246 'Position',frame3_pos, ...
247 'Style','frame'),'units','normalized');
248
249 s = ['vis_show_gui_tool(' mat2str(h) ',''label'',' mat2str(fig_h) ')'];
250 set( ...
251 uicontrol( ... %% OK
252 'Units','pixels', ...
253 'Position',ok_pos, ...
254 'String','OK', ...
255 'Callback',s),'units','normalized');
256
257 set( ...
258 uicontrol( ... %% Cancel
259 'Units','pixels', ...
260 'Position',cancel_pos, ...
261 'String','Cancel', ...
262 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
263
264 watchoff(old_fig_n);
265 ud = [ed1_h ed2_h ed3_h p_h];
266 set(fig_h,'units','normalized', ...
267 'Visible','on', ...
268 'UserData',ud, ...
269 'handlevisibility','off');
270
271 %%%%%%%%%
272 % add_hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
273 %%%%%%%%%
274 elseif strcmp(action,'add_hit')
275 old_fig_n = watchon;
276 W = 424.3; H = 337.642;
277 o37 = zeros(1,4);
278 o37(1) = (W-f_fr(3))/2;
279 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
280 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
281 hint_txt = [W 18.45]; % hint text width and height
282 units = get(h,'units');
283 set(h,'units','pixels');
284 fp = get(h,'Position');
285 fig_pos = [(fp(1)+fp(3)) ...
286 (fp(2)+fp(2)+fp(4)/2-H/2) ...
287 W ...
288 H];
289 o1 = sum(f_fr([2 4]))+frames_dist;
290 o2 = o1+dist1;
291 o6 = max([title_txt(2),var_pop(2)]);
292 o7 = max([title_txt(2),title_edit_h]);
293 o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
294 o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
295 o3 = o8+o6+3*dist1;
296 o4 = o1+0.5*o8+dist1-title_txt(2)/2;
297 o5 = o1+0.5*o8+dist1-var_pop(2)/2;
298 o9 = o1+0.5*o8+dist1-title_edit_h/2;
299 o21 = o1+o8+0.5*o6+2*dist1-title_txt(2)/2;
300 o22 = o1+o8+0.5*o6+2*dist1-var_pop(2)/2;
301 o20 = ok_pb(1)+title_txt(1);
302 o10 = o20+var_pop(1)+2*dist1;
303 o11 = o10+title_txt(1);
304 o12 = o2+o8+dist1+0.5*o6-title_txt(2)/2;
305 o13 = o2+o8+dist1+0.5*o6-var_pop(2)/2;
306 o14 = o1+o3+frames_dist2;
307 o15 = 2*o6+o8+4*dist1;
308 o16 = o14+dist1+0.5*o6-title_txt(2)/2;
309 o17 = o14+dist1+0.5*o6-var_pop(2)/2;
310 o18 = o14+o6+2*dist1+0.5*o8-title_txt(2)/2;
311 o19 = o14+o6+2*dist1+0.5*o8-title_edit_h/2;
312 o23 = o14+o6+2*dist1+0.5*o8-var_pop(2)/2;
313 o24 = o14+o6+3*dist1+o8+0.5*o6-title_txt(2)/2;
314 o25 = o14+o6+3*dist1+o8+0.5*o6-var_pop(2)/2;
315 o26 = o14+o15+frames_dist2;
316 o27 = o8+2*dist1;
317 o28 = o26+dist1+0.5*o38-title_txt(2)/2;
318 o29 = o26+dist1+0.5*o38-title_edit_h/2;
319 o30 = o26+dist1+0.5*o38-selvar_pb(2)/2;
320 o31 = o10; %W-(ok_pb(1)+selvar_pb(1));
321 o32 = o26+o27+frames_dist2;
322 o33 = o7+2*dist1;
323 o34 = o32+dist1+0.5*o7-title_txt(2)/2;
324 o35 = o32+dist1+0.5*o7-title_edit_h/2;
325 o36 = o32+o33+hint_dist1;
326 hint_text_pos = [1 o36 hint_txt];
327 frame1_pos = [f_fr(1) o32 f_fr(3) o33];
328 subplots_text_pos = [ok_pb(1) o34 title_txt];
329 subplots_pos = [o20 o35 strd_ed];
330 frame2_pos = [f_fr(1) o26 f_fr(3) o27];
331 trace_vect_text_pos = [ok_pb(1) o28 title_txt];
332 trace_vect_pos = [o20 o29 strd_ed];
333 sel_vect_pos = [o31 o30 selvar_pb];
334 frame3_pos = [f_fr(1) o14 f_fr(3) o15];
335 marker_text_pos = [ok_pb(1) o24 title_txt];
336 marker_pos = [o20 o25 var_pop];
337 marker_size_text_pos = [ok_pb(1) o18 title_txt];
338 marker_size_pos = [o20 o19 strd_ed];
339 size_fact_text_pos = [o10 o18 title_txt];
340 size_fact_pos = [o11 o23 var_pop];
341 marker_color_text_pos = [ok_pb(1) o16 title_txt];
342 marker_color_pos = [o20 o17 var_pop];
343 edge_color_text_pos = [o10 o16 title_txt];
344 edge_color_pos = [o11 o17 var_pop];
345 frame4_pos = [f_fr(1) o1 f_fr(3) o3];
346 text_text_pos = [ok_pb(1) o21 title_txt];
347 text_pos = [o20 o22 var_pop];
348 text_color_text_pos = [ok_pb(1) o4 title_txt];
349 text_color_pos = [o20 o5 var_pop];
350 text_size_text_pos = [o10 o4 title_txt];
351 text_size_pos = [o11 o9 strd_ed];
352 f_fr = [7.9 8.38 216.2 36.9]; % final frame
353 cancel_pb = [139 15.76 75.9 22.14];
354 frame5_pos = f_fr+o37;
355 ok_pos = ok_pb+o37;
356 cancel_pos = cancel_pb+o37;
357
358 fig_h = figure( ...
359 'Units','pixels', ...
360 'Position', fig_pos, ...
361 'Color',fig_color, ...
362 'NumberTitle','off', ...
363 'Name','add hit histogram', ...
364 'MenuBar','none', ...
365 'Visible','off');
366
367 set( ...
368 uicontrol( ... %% hint
369 'Units','pixels', ...
370 'BackgroundColor',fig_color, ...
371 'HorizontalAlignment','center', ...
372 'Position',hint_text_pos, ...
373 'String','Options for adding hit histogram', ...
374 'Style','text'),'units','normalized');
375
376 set( ...
377 uicontrol( ... %% [frame]
378 'Units','pixels', ...
379 'Position',frame1_pos, ...
380 'Style','frame'),'units','normalized');
381
382 set( ...
383 uicontrol( ... %% To subplot(s)
384 'Units','pixels', ...
385 'Position',subplots_text_pos, ...
386 'HorizontalAlignment','left', ...
387 'String','To subplot(s)', ...
388 'Style','text'),'units','normalized');
389
390 ed1_h = uicontrol( ... %% [edit]
391 'Units','pixels', ...
392 'BackgroundColor',bg_color2, ...
393 'Position',subplots_pos, ...
394 'FontSize',12, ...
395 'Style','edit');
396 set(ed1_h,'units','normalized');
397
398 set( ...
399 uicontrol( ... %% [frame]
400 'Units','pixels', ...
401 'Position',frame2_pos, ...
402 'Style','frame'),'units','normalized');
403
404 set( ...
405 uicontrol( ... %% Trace vector
406 'Units','pixels', ...
407 'Position',trace_vect_text_pos, ...
408 'HorizontalAlignment','left', ...
409 'String','Hit vector', ...
410 'Style','text'),'units','normalized');
411
412 ed2_h = uicontrol( ... %% [edit]
413 'Units','pixels', ...
414 'BackgroundColor',bg_color2, ...
415 'Position',trace_vect_pos, ...
416 'FontSize',12, ...
417 'Style','edit');
418 set(ed2_h,'units','normalized');
419
420 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
421 'vis_show_gui_tool(tmp(2),''select'')'];
422 set( ...
423 uicontrol( ... %% Select variable
424 'Units','pixels', ...
425 'Position',sel_vect_pos, ...
426 'String','Select variable', ...
427 'Callback',s),'units','normalized');
428
429 set( ...
430 uicontrol( ... %% [frame]
431 'Units','pixels', ...
432 'Position',frame3_pos, ...
433 'Style','frame'),'units','normalized');
434
435 set( ...
436 uicontrol( ... %% Marker
437 'Units','pixels', ...
438 'Position',marker_text_pos, ...
439 'HorizontalAlignment','left', ...
440 'String','Marker', ...
441 'Style','text'),'units','normalized');
442
443 s = {'lattice' 'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
444 '<' '>' 'p' 'h' 'none' 'cell array'};
445 p3_h = uicontrol( ... %% [popupmenu]
446 'Units','pixels', ...
447 'Position',marker_pos, ...
448 'String',s, ...
449 'Style','popupmenu');
450 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
451 'vis_show_gui_tool([tmp(6),16],''popup_select'')'];
452 set(p3_h,'units','normalized','Callback',s);
453
454 set( ...
455 uicontrol( ... %% Marker size
456 'Units','pixels', ...
457 'HorizontalAlignment','left', ...
458 'Position',marker_size_text_pos, ...
459 'String','Marker size', ...
460 'Style','text'),'units','normalized');
461
462 ed4_h = uicontrol( ... %% [edit]
463 'Units','pixels', ...
464 'BackgroundColor',bg_color2, ...
465 'Position',marker_size_pos, ...
466 'String','12', ...
467 'FontSize',12, ...
468 'Style','edit');
469 set(ed4_h,'units','normalized','Callback',s);
470
471 set( ...
472 uicontrol( ... %% Size factor
473 'Units','pixels', ...
474 'HorizontalAlignment','left', ...
475 'Position',size_fact_text_pos, ...
476 'String','Size factor', ...
477 'Style','text'),'units','normalized');
478
479 s = {'common' 'separate'};
480 p4_h = uicontrol( ... %% [popupmenu]
481 'Units','pixels', ...
482 'Position',size_fact_pos, ...
483 'String',s, ...
484 'Style','popupmenu');
485 set(p4_h,'units','normalized');
486
487
488 set( ...
489 uicontrol( ... %% Marker color
490 'Units','pixels', ...
491 'HorizontalAlignment','left', ...
492 'Position',marker_color_text_pos, ...
493 'String','Marker color', ...
494 'Style','text'),'units','normalized');
495
496 ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''};
497 s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
498 'red' 'green' 'blue' 'none' '-matrix-'};
499 p5_h = uicontrol( ... %% [popupmenu]
500 'Units','pixels', ...
501 'Position',marker_color_pos, ...
502 'UserData',ud, ...
503 'String',s, ...
504 'Style','popupmenu');
505 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
506 'vis_show_gui_tool([tmp(9) 10],''popup_select'')'];
507 set(p5_h,'units','normalized','Callback',s);
508
509 set( ...
510 uicontrol( ... %% EdgeColor
511 'Units','pixels', ...
512 'Position',edge_color_text_pos, ...
513 'HorizontalAlignment','left', ...
514 'String','Edge color', ...
515 'Style','text'),'units','normalized');
516
517 ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
518 s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
519 'red' 'green' 'blue'};
520 p6_h = uicontrol( ... %% [popupmenu]
521 'Units','pixels', ...
522 'Position',edge_color_pos, ...
523 'UserData',ud, ...
524 'String',s, ...
525 'Style','popupmenu');
526 set(p6_h,'units','normalized');
527
528 set( ...
529 uicontrol( ... %% [frame]
530 'Units','pixels', ...
531 'Position',frame4_pos, ...
532 'Style','frame'),'units','normalized');
533
534 set( ...
535 uicontrol( ... %% Text
536 'Units','pixels', ...
537 'Position',text_text_pos, ...
538 'HorizontalAlignment','left', ...
539 'String','Text', ...
540 'Style','text'),'units','normalized');
541
542 s = {'off' 'on'};
543 p2_h = uicontrol( ... %% [popupmenu]
544 'Units','pixels', ...
545 'Position',text_pos, ...
546 'String',s, ...
547 'Style','popupmenu');
548 set(p2_h,'units','normalized');
549
550 set( ...
551 uicontrol( ... %% Text
552 'Units','pixels', ...
553 'Position',text_text_pos, ...
554 'HorizontalAlignment','left', ...
555 'String','Text', ...
556 'Style','text'),'units','normalized');
557
558 s = {'off' 'on'};
559 p2_h = uicontrol( ... %% [popupmenu]
560 'Units','pixels', ...
561 'Position',text_pos, ...
562 'String',s, ...
563 'Style','popupmenu');
564 set(p2_h,'units','normalized');
565
566 set( ...
567 uicontrol( ... %% Text color
568 'Units','pixels', ...
569 'Position',text_color_text_pos, ...
570 'HorizontalAlignment','left', ...
571 'String','Text color', ...
572 'Style','text'),'units','normalized');
573
574 ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'};
575 s = {'black' 'white' 'yellow' 'magenta' 'cyan' ...
576 'red' 'green' 'blue' 'xor'};
577 p1_h = uicontrol( ... %% [popupmenu]
578 'Units','pixels', ...
579 'Position',text_color_pos, ...
580 'UserData',ud, ...
581 'String',s, ...
582 'Style','popupmenu');
583 set(p1_h,'units','normalized');
584
585 set( ...
586 uicontrol( ... %% Text size
587 'Units','pixels', ...
588 'Position',text_size_text_pos, ...
589 'HorizontalAlignment','left', ...
590 'String','Text size', ...
591 'Style','text'),'units','normalized');
592
593 ed3_h = uicontrol( ... %% [edit]
594 'Units','pixels', ...
595 'BackgroundColor',bg_color2, ...
596 'Position',text_size_pos, ...
597 'String','3', ...
598 'FontSize',12, ...
599 'Style','edit');
600 set(ed3_h,'units','normalized');
601
602 set( ...
603 uicontrol( ... %% [frame]
604 'Units','pixels', ...
605 'Position',frame5_pos, ...
606 'Style','frame'),'units','normalized');
607
608 s = ['vis_show_gui_tool(' mat2str(h) ',''hit'',' mat2str(fig_h) ')'];
609 set( ...
610 uicontrol( ... %% OK
611 'Units','pixels', ...
612 'Position',ok_pos, ...
613 'String','OK', ...
614 'Callback',s),'units','normalized');
615
616 set( ...
617 uicontrol( ... %% Cancel
618 'Units','pixels', ...
619 'Position',cancel_pos, ...
620 'String','Cancel', ...
621 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
622
623 watchoff(old_fig_n);
624 tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h];
625 set(fig_h,'units','normalized', ...
626 'Visible','on', ...
627 'UserData',tmp_udata, ...
628 'handlevisibility','off');
629
630 %%%%%%%%%%
631 % add_traj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
632 %%%%%%%%%%
633 elseif strcmp(action,'add_traj')
634 old_fig_n = watchon;
635 W = 424.3; H = 337.642;
636 o34 = zeros(1,4);
637 o34(1) = (W-f_fr(3))/2;
638 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
639 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
640 hint_txt = [W 18.45]; % hint text width and height
641 units = get(h,'units');
642 set(h,'units','pixels');
643 fp = get(h,'Position');
644 fig_pos = [(fp(1)+fp(3)) ...
645 (fp(2)+fp(2)+fp(4)/2-H/2) ...
646 W ...
647 H];
648 o1 = sum(f_fr([2 4]))+frames_dist;
649 o2 = o1+dist1;
650 o6 = max([title_txt(2),var_pop(2)]);
651 o7 = max([title_txt(2),title_edit_h]);
652 o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
653 o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
654 o20 = ok_pb(1)+title_txt(1);
655 o10 = o20+var_pop(1)+2*dist1;
656 o11 = o10+title_txt(1);
657 o3 = 2*o6+o8+4*dist1;
658 o4 = o1+dist1+0.5*o6-title_txt(2)/2;
659 o5 = o1+dist1+0.5*o6-var_pop(2)/2;
660 o9 = o1+2*dist1+o6+0.5*o8-title_txt(2)/2;
661 o12 = o1+2*dist1+o6+0.5*o8-title_edit_h/2;
662 o13 = o1+2*dist1+o6+0.5*o8-var_pop(2)/2;
663 o14 = o1+3*dist1+o6+o8+0.5*o6-title_edit_h/2;
664 o15 = o1+3*dist1+o6+o8+0.5*o6-var_pop(2)/2;
665 o16 = o1+o3+frames_dist2;
666 o17 = o8+o6+3*dist1;
667 o18 = o16+dist1+0.5*o8-title_txt(2)/2;
668 o19 = o16+dist1+0.5*o8-title_edit_h/2;
669 o21 = o16+dist1+0.5*o8-var_pop(2)/2;
670 o22 = o16+2*dist1+o8+0.5*o6-title_txt(2)/2;
671 o23 = o16+2*dist1+o8+0.5*o6-var_pop(2)/2;
672 o24 = o16+o17+frames_dist2;
673 o25 = o38+2*dist1;
674 o26 = o24+dist1+0.5*o38-title_txt(2)/2;
675 o27 = o24+dist1+0.5*o38-title_edit_h/2;
676 o28 = o24+dist1+0.5*o38-selvar_pb(2)/2;
677 o29 = o24+o25+frames_dist2;
678 o30 = o7+2*dist1;
679 o31 = o29+dist1+0.5*o7-title_txt(2)/2;
680 o32 = o29+dist1+0.5*o7-title_edit_h/2;
681 o33 = o29+o30+hint_dist1;
682 hint_text_pos = [1 o33 hint_txt];
683 frame1_pos = [f_fr(1) o29 f_fr(3) o30];
684 subplots_text_pos = [ok_pb(1) o31 title_txt];
685 subplots_pos = [o20 o32 strd_ed];
686 frame2_pos = [f_fr(1) o24 f_fr(3) o25];
687 trace_vect_text_pos = [ok_pb(1) o26 title_txt];
688 trace_vect_pos = [o20 o27 strd_ed];
689 sel_vect_pos = [o10 o28 selvar_pb];
690 frame3_pos = [f_fr(1) o16 f_fr(3) o17];
691 line_color_text_pos = [ok_pb(1) o22 title_txt];
692 line_color_pos = [o20 o23 var_pop];
693 line_width_text_pos = [ok_pb(1) o18 title_txt];
694 line_width_pos = [o20 o19 strd_ed];
695 width_factor_text_pos = [o10 o18 title_txt];
696 width_factor_pos = [o11 o19 var_pop];
697 frame4_pos = [f_fr(1) o1 f_fr(3) o3];
698 marker_text_pos = [ok_pb(1) o14 title_txt];
699 marker_pos = [o20 o15 var_pop];
700 marker_size_text_pos = [ok_pb(1) o9 title_txt];
701 marker_size_pos = [o20 o12 strd_ed];
702 size_factor_text_pos = [o10 o9 title_txt];
703 size_factor_pos = [o11 o13 var_pop];
704 marker_color_text_pos = [ok_pb(1) o4 title_txt];
705 marker_color_pos = [o20 o5 var_pop];
706 edge_color_text_pos = [o10 o4 title_txt];
707 edge_color_pos = [o11 o5 var_pop];
708 f_fr = [7.9 8.38 216.2 36.9]; % final frame
709 cancel_pb = [139 15.76 75.9 22.14];
710 frame5_pos = f_fr+o34;
711 ok_pos = ok_pb+o34;
712 cancel_pos = cancel_pb+o34;
713
714 fig_h = figure( ...
715 'Units','pixels', ...
716 'Position', fig_pos, ...
717 'Color',fig_color, ...
718 'NumberTitle','off', ...
719 'Name','add trajectory', ...
720 'MenuBar','none', ...
721 'Visible','off');
722
723 set( ...
724 uicontrol( ... %% hint
725 'Units','pixels', ...
726 'BackgroundColor',fig_color, ...
727 'HorizontalAlignment','center', ...
728 'Position',hint_text_pos, ...
729 'String','Options for adding trajectory', ...
730 'Style','text'),'units','normalized');
731
732 set( ...
733 uicontrol( ... %% [frame]
734 'Units','pixels', ...
735 'Position',frame1_pos, ...
736 'Style','frame'),'units','normalized');
737
738 set( ...
739 uicontrol( ...
740 'Units','pixels', ... %% To subplot(s)
741 'Position',subplots_text_pos, ...
742 'HorizontalAlignment','left', ...
743 'String','To subplot(s)', ...
744 'Style','text'),'units','normalized');
745
746 ed1_h = uicontrol( ... %% [edit]
747 'Units','pixels', ...
748 'BackgroundColor',bg_color2, ...
749 'Position',subplots_pos, ...
750 'FontSize',12, ...
751 'Style','edit');
752 set(ed1_h,'units','normalized');
753
754 set( ...
755 uicontrol( ... %% [frame]
756 'Units','pixels', ...
757 'Position',frame2_pos, ...
758 'Style','frame'),'units','normalized');
759
760 set( ...
761 uicontrol( ... %% Trace vector
762 'Units','pixels', ...
763 'Position',trace_vect_text_pos, ...
764 'HorizontalAlignment','left', ...
765 'String','Trajectory', ...
766 'Style','text'),'units','normalized');
767
768 ed2_h = uicontrol( ... %% [edit]
769 'Units','pixels', ...
770 'BackgroundColor',bg_color2, ...
771 'Position',trace_vect_pos, ...
772 'FontSize',12, ...
773 'Style','edit');
774 set(ed2_h,'units','normalized');
775
776 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
777 'vis_show_gui_tool(tmp(2),''select'')'];
778 set( ...
779 uicontrol( ... %% Select variable
780 'Units','pixels', ...
781 'Position',sel_vect_pos, ...
782 'String','Select variable', ...
783 'Callback',s),'units','normalized');
784
785 set( ...
786 uicontrol( ... %% [frame]
787 'Units','pixels', ...
788 'Position',frame3_pos, ...
789 'Style','frame'),'units','normalized');
790
791 set( ...
792 uicontrol( ... %% Line color
793 'Units','pixels', ...
794 'Position',line_color_text_pos, ...
795 'HorizontalAlignment','left', ...
796 'String','Line color', ...
797 'Style','text'),'units','normalized');
798
799 ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'};
800 s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
801 'red' 'green' 'blue' 'xor'};
802 p1_h = uicontrol( ... %% [popupmenu]
803 'Units','pixels', ...
804 'Position',line_color_pos, ...
805 'UserData',ud, ...
806 'String',s, ...
807 'Style','popupmenu');
808 set(p1_h,'units','normalized');
809
810 set( ...
811 uicontrol( ... %% Line width
812 'Units','pixels', ...
813 'Position',line_width_text_pos, ...
814 'HorizontalAlignment','left', ...
815 'String','Line width', ...
816 'Style','text'),'units','normalized');
817
818 ed3_h = uicontrol( ... %% [edit]
819 'Units','pixels', ...
820 'BackgroundColor',bg_color2, ...
821 'Position',line_width_pos, ...
822 'String','3', ...
823 'FontSize',12, ...
824 'Style','edit');
825 set(ed3_h,'units','normalized');
826
827 set( ...
828 uicontrol( ... %% Factor
829 'Units','pixels', ...
830 'Position',width_factor_text_pos, ...
831 'HorizontalAlignment','left', ...
832 'String','Factor', ...
833 'Style','text'),'units','normalized');
834
835 s = {'hit' 'equal'};
836 p2_h = uicontrol( ... %% [popupmenu]
837 'Units','pixels', ...
838 'Position',width_factor_pos, ...
839 'String',s, ...
840 'Style','popupmenu');
841 set(p2_h,'units','normalized');
842
843 set( ...
844 uicontrol( ... %% [frame]
845 'Units','pixels', ...
846 'Position',frame4_pos, ...
847 'Style','frame'),'units','normalized');
848
849 set( ...
850 uicontrol( ... %% Marker
851 'Units','pixels', ...
852 'Position',marker_text_pos, ...
853 'HorizontalAlignment','left', ...
854 'String','Marker', ...
855 'Style','text'),'units','normalized');
856
857 s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
858 '<' '>' 'p' 'h' 'none'};
859 p3_h = uicontrol( ... %% [popupmenu]
860 'Units','pixels', ...
861 'Position',marker_pos, ...
862 'String',s, ...
863 'Style','popupmenu');
864 set(p3_h,'units','normalized');
865
866 set( ...
867 uicontrol( ... %% Marker size
868 'Units','pixels', ...
869 'HorizontalAlignment','left', ...
870 'Position',marker_size_text_pos, ...
871 'String','Marker size', ...
872 'Style','text'),'units','normalized');
873
874 ed4_h = uicontrol( ... %% [edit]
875 'Units','pixels', ...
876 'BackgroundColor',bg_color2, ...
877 'Position',marker_size_pos, ...
878 'String','10', ...
879 'FontSize',12, ...
880 'Style','edit');
881 set(ed4_h,'units','normalized');
882
883 set( ...
884 uicontrol( ... %% Factor
885 'Units','pixels', ...
886 'HorizontalAlignment','left', ...
887 'Position',size_factor_text_pos, ...
888 'HorizontalAlignment','left', ...
889 'String','Factor', ...
890 'Style','text'),'units','normalized');
891
892 s = {'hit' 'equal'};
893 p4_h = uicontrol( ... %% [popupmenu]
894 'Units','pixels', ...
895 'Position',size_factor_pos, ...
896 'String',s, ...
897 'Style','popupmenu');
898 set(p4_h,'units','normalized');
899
900 set( ...
901 uicontrol( ... %% Marker color
902 'Units','pixels', ...
903 'HorizontalAlignment','left', ...
904 'Position',marker_color_text_pos, ...
905 'String','Marker color', ...
906 'Style','text'),'units','normalized');
907
908 ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none'};
909 s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
910 'red' 'green' 'blue' 'none'};
911 p5_h = uicontrol( ... %% [popupmenu]
912 'Units','pixels', ...
913 'Position',marker_color_pos, ...
914 'UserData',ud, ...
915 'String',s, ...
916 'Style','popupmenu');
917 set(p5_h,'units','normalized');
918
919 set( ...
920 uicontrol( ... %% Edge color
921 'Units','pixels', ...
922 'Position',edge_color_text_pos, ...
923 'HorizontalAlignment','left', ...
924 'String','Edge color', ...
925 'Style','text'),'units','normalized');
926
927 ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
928 s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
929 'red' 'green' 'blue'};
930 p6_h = uicontrol( ... %% [popupmenu]
931 'Units','pixels', ...
932 'Position',edge_color_pos, ...
933 'UserData',ud, ...
934 'String',s, ...
935 'Style','popupmenu');
936 set(p6_h,'units','normalized');
937
938 set( ...
939 uicontrol( ... %% [frame]
940 'Units','pixels', ...
941 'Position',frame5_pos, ...
942 'Style','frame'),'units','normalized');
943
944 s = ['vis_show_gui_tool(' mat2str(h) ',''traj'',' mat2str(fig_h) ')'];
945 set( ...
946 uicontrol( ... %% OK
947 'Units','pixels', ...
948 'Position',ok_pos, ...
949 'String','OK', ...
950 'Callback',s),'units','normalized');
951
952 set( ...
953 uicontrol( ... %% Cancel
954 'Units','pixels', ...
955 'Position',cancel_pos, ...
956 'String','Cancel', ...
957 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
958
959 watchoff(old_fig_n);
960 tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h];
961 set(fig_h,'units','normalized', ...
962 'Visible','on', ...
963 'UserData',tmp_udata, ...
964 'handlevisibility','off');
965
966 %%%%%%%%%%%
967 % add_comet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
968 %%%%%%%%%%%
969 elseif strcmp(action,'add_comet')
970 old_fig_n = watchon;
971 W = 424.3; H = 265.589;
972 o26 = zeros(1,4);
973 o26(1) = (W-f_fr(3))/2;
974 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
975 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
976 hint_txt = [W 18.45]; % hint text width and height
977 units = get(h,'units');
978 set(h,'units','pixels');
979 fp = get(h,'Position');
980 fig_pos = [(fp(1)+fp(3)) ...
981 (fp(2)+fp(2)+fp(4)/2-H/2) ...
982 W ...
983 H];
984 o1 = sum(f_fr([2 4]))+frames_dist;
985 o2 = o1+dist1;
986 o6 = max([title_txt(2),var_pop(2)]);
987 o7 = max([title_txt(2),title_edit_h]);
988 o8 = max([title_txt(2),title_edit_h,var_pop(2)]);
989 o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
990 o20 = ok_pb(1)+title_txt(1);
991 o10 = o20+var_pop(1)+2*dist1;
992 o11 = o10+title_txt(1);
993 o3 = 2*o6+o7+4*dist1;
994 o4 = o1+dist1+0.5*o6-title_txt(2)/2;
995 o5 = o1+dist1+0.5*o6-var_pop(2)/2;
996 o9 = o1+2*dist1+o6+0.5*o7-title_txt(2)/2;
997 o12 = o1+2*dist1+o6+0.5*o7-title_edit_h/2;
998 o13 = o1+3*dist1+o7+1.5*o6-title_txt(2)/2;
999 o14 = o1+3*dist1+o7+1.5*o6-var_pop(2)/2;
1000 o15 = o1+o3+frames_dist2;
1001 o16 = o38+2*dist1;
1002 o17 = o15+dist1+0.5*o38-title_txt(2)/2;
1003 o18 = o15+dist1+0.5*o38-title_edit_h/2;
1004 o19 = o15+dist1+0.5*o38-selvar_pb(2)/2;
1005 o21 = o15+o16+frames_dist2;
1006 o22 = o7+2*dist1;
1007 o23 = o21+dist1+0.5*o7-title_txt(2)/2;
1008 o24 = o21+dist1+0.5*o7-title_edit_h/2;
1009 o25 = o21+o22+hint_dist1;
1010 hint_text_pos = [1 o25 hint_txt];
1011 frame1_pos = [f_fr(1) o21 f_fr(3) o22];
1012 subplots_text_pos = [ok_pb(1) o23 title_txt];
1013 subplots_pos = [o20 o24 strd_ed];
1014 frame2_pos = [f_fr(1) o15 f_fr(3) o16];
1015 trace_vect_text_pos = [ok_pb(1) o17 title_txt];
1016 trace_vect_pos = [o20 o18 strd_ed];
1017 sel_var_pos = [o10 o19 selvar_pb];
1018 frame3_pos = [f_fr(1) o1 f_fr(3) o3];
1019 marker_text_pos = [ok_pb(1) o13 title_txt];
1020 marker_pos = [o20 o14 var_pop];
1021 marker_size_text_pos = [ok_pb(1) o9 title_txt];
1022 marker_size_pos = [o20 o12 var_pop];
1023 marker_color_text_pos = [ok_pb(1) o4 title_txt];
1024 marker_color_pos = [o20 o5 var_pop];
1025 edge_color_text_pos = [o10 o4 title_txt];
1026 edge_color_pos = [o11 o5 var_pop];
1027 f_fr = [7.9 8.38 216.2 36.9]; % final frame
1028 cancel_pb = [139 15.76 75.9 22.14];
1029 frame4_pos = f_fr+o26;
1030 ok_pos = ok_pb+o26;
1031 cancel_pos = cancel_pb+o26;
1032
1033 fig_h = figure( ...
1034 'Units','pixels', ...
1035 'Position', fig_pos, ...
1036 'Color',fig_color, ...
1037 'NumberTitle','off', ...
1038 'Name','add comet', ...
1039 'MenuBar','none', ...
1040 'Visible','off');
1041
1042 set( ...
1043 uicontrol( ... %% hint
1044 'Units','pixels', ...
1045 'BackgroundColor',fig_color, ...
1046 'HorizontalAlignment','center', ...
1047 'Position',hint_text_pos, ...
1048 'String','Options for adding comet', ...
1049 'Style','text'),'units','normalized');
1050
1051 set( ...
1052 uicontrol( ... %% [frame]
1053 'Units','pixels', ...
1054 'Position',frame1_pos, ...
1055 'Style','frame'),'units','normalized');
1056
1057 set( ...
1058 uicontrol( ... %% To subplot(s)
1059 'Units','pixels', ...
1060 'Position',subplots_text_pos, ...
1061 'HorizontalAlignment','left', ...
1062 'String','To subplot(s)', ...
1063 'Style','text'),'units','normalized');
1064
1065 ed1_h = uicontrol( ... %% [edit]
1066 'Units','pixels', ...
1067 'BackgroundColor',bg_color2, ...
1068 'Position',subplots_pos, ...
1069 'FontSize',12, ...
1070 'Style','edit');
1071 set(ed1_h,'units','normalized');
1072
1073 set( ...
1074 uicontrol( ... %% [frame]
1075 'Units','pixels', ...
1076 'Position',frame2_pos, ...
1077 'Style','frame'),'units','normalized');
1078
1079 set( ...
1080 uicontrol( ... %% Trace vector
1081 'Units','pixels', ...
1082 'Position',trace_vect_text_pos, ...
1083 'HorizontalAlignment','left', ...
1084 'String','Trace vector', ...
1085 'Style','text'),'units','normalized');
1086
1087 ed2_h = uicontrol( ... %% [edit]
1088 'Units','pixels', ...
1089 'BackgroundColor',bg_color2, ...
1090 'Position',trace_vect_pos, ...
1091 'FontSize',12, ...
1092 'Style','edit');
1093 set(ed2_h,'units','normalized');
1094
1095 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1096 'vis_show_gui_tool(tmp(2),''select'')'];
1097 set( ...
1098 uicontrol( ... %% Select variable
1099 'Units','pixels', ...
1100 'Position',sel_var_pos, ...
1101 'String','Select variable', ...
1102 'Callback',s),'units','normalized');
1103
1104 set( ...
1105 uicontrol( ... %% [frame]
1106 'Units','pixels', ...
1107 'Position',frame3_pos, ...
1108 'Style','frame'),'units','normalized');
1109
1110 set( ...
1111 uicontrol( ... %% Marker
1112 'Units','pixels', ...
1113 'Position',marker_text_pos, ...
1114 'HorizontalAlignment','left', ...
1115 'String','Marker', ...
1116 'Style','text'),'units','normalized');
1117
1118 s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ...
1119 '<' '>' 'p' 'h' 'lattice' 'none'};
1120 p1_h = uicontrol( ... %% [popupmenu]
1121 'Units','pixels', ...
1122 'Position',marker_pos, ...
1123 'String',s, ...
1124 'Style','popupmenu');
1125 set(p1_h,'units','normalized');
1126
1127 set( ...
1128 uicontrol( ... %% Marker size
1129 'Units','pixels', ...
1130 'HorizontalAlignment','left', ...
1131 'Position',marker_size_text_pos, ...
1132 'String','Marker size', ...
1133 'Style','text'),'units','normalized');
1134
1135 ed3_h = uicontrol( ... %% [edit]
1136 'Units','pixels', ...
1137 'BackgroundColor',bg_color2, ...
1138 'Position',marker_size_pos, ...
1139 'String','[20 4]', ...
1140 'FontSize',12, ...
1141 'Style','edit');
1142 set(ed3_h,'units','normalized');
1143
1144 set( ...
1145 uicontrol( ... %% Marker color
1146 'Units','pixels', ...
1147 'HorizontalAlignment','left', ...
1148 'Position',marker_color_text_pos, ...
1149 'String','Marker color', ...
1150 'Style','text'),'units','normalized');
1151
1152 ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''};
1153 s = {'white' 'black' 'yellow' 'magenta' 'cyan' ...
1154 'red' 'green' 'blue' 'none' '-matrix-'};
1155 p2_h = uicontrol( ... %% [popupmenu]
1156 'Units','pixels', ...
1157 'Position',marker_color_pos, ...
1158 'UserData',ud, ...
1159 'String',s, ...
1160 'Style','popupmenu');
1161 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1162 'vis_show_gui_tool([tmp(5) 10],''popup_select'')'];
1163 set(p2_h,'units','normalized','Callback',s);
1164
1165 set( ...
1166 uicontrol( ... %% Edge color
1167 'Units','pixels', ...
1168 'Position',edge_color_text_pos, ...
1169 'HorizontalAlignment','left', ...
1170 'String','Edge color', ...
1171 'Style','text'),'units','normalized');
1172
1173 ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'};
1174 s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ...
1175 'red' 'green' 'blue'};
1176 p3_h = uicontrol( ... %% [popupmenu]
1177 'Units','pixels', ...
1178 'Position',edge_color_pos, ...
1179 'UserData',ud, ...
1180 'String',s, ...
1181 'Style','popupmenu');
1182 set(p3_h,'units','normalized');
1183
1184 set( ...
1185 uicontrol( ... %% [frame]
1186 'Units','pixels', ...
1187 'Position',frame4_pos, ...
1188 'Style','frame'),'units','normalized');
1189
1190 s = ['vis_show_gui_tool(' mat2str(h) ',''comet'',' mat2str(fig_h) ')'];
1191 set( ...
1192 uicontrol( ... %% OK
1193 'Units','pixels', ...
1194 'Position',ok_pos, ...
1195 'String','OK', ...
1196 'Callback',s),'units','normalized');
1197
1198 set( ...
1199 uicontrol( ... %% Cancel
1200 'Units','pixels', ...
1201 'Position',cancel_pos, ...
1202 'String','Cancel', ...
1203 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
1204
1205 watchoff(old_fig_n);
1206 tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h];
1207 set(fig_h,'units','normalized', ...
1208 'Visible','on', ...
1209 'UserData',tmp_udata, ...
1210 'handlevisibility','off');
1211
1212 %%%%%%%%%%%%
1213 % recolorbar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1214 %%%%%%%%%%%%
1215 elseif strcmp(action,'recolorbar')
1216 old_fig_n = watchon;
1217 W = 345.4; H = 237.299;
1218 o25 = zeros(1,4);
1219 o25(1) = (W-f_fr(3))/2;
1220 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
1221 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
1222 hint_txt = [W 18.45]; % hint text width and height
1223 units = get(h,'units');
1224 set(h,'units','pixels');
1225 fp = get(h,'Position');
1226 fig_pos = [(fp(1)+fp(3)) ...
1227 (fp(2)+fp(2)+fp(4)/2-H/2) ...
1228 W ...
1229 H];
1230 o1 = sum(f_fr([2 4]))+frames_dist;
1231 o2 = o1+dist1;
1232 o6 = max([title_txt(2),var_pop(2)]);
1233 o7 = max([title_txt(2),title_edit_h]);
1234 o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]);
1235 o20 = ok_pb(1)+title_txt(1);
1236 o10 = o20+var_pop(1)+2*dist1;
1237 o11 = o10+title_txt(1);
1238 o3 = o6+2*dist1;
1239 o4 = o1+dist1+0.5*o6-title_txt(2)/2;
1240 o5 = o1+dist1+0.5*o6-var_pop(2)/2;
1241 o9 = o1+o3+frames_dist2;
1242 o12 = 2*o8+3*dist1;
1243 o13 = o9+dist1+0.5*o8-title_txt(2)/2;
1244 o14 = o9+dist1+0.5*o8-title_edit_h/2;
1245 o15 = o9+dist1+0.5*o8-var_pop(2)/2;
1246 o16 = o9+2*dist1+1.5*o8-title_txt(2)/2;
1247 o17 = o9+2*dist1+1.5*o8-title_edit_h/2;
1248 o18 = o9+2*dist1+1.5*o8-var_pop(2)/2;
1249 o19 = o9+o12+frames_dist2;
1250 o21 = o7+2*dist1;
1251 o22 = o19+dist1+0.5*o7-title_txt(2)/2;
1252 o23 = o19+dist1+0.5*o7-title_edit_h/2;
1253 o24 = o19+o21+hint_dist1;
1254 hint_text_pos = [1 o24 hint_txt];
1255 frame1_pos = [f_fr(1) o19 f_fr(3) o21];
1256 subplots_text_pos = [ok_pb(1) o22 title_txt];
1257 subplots_pos = [o20 o23 strd_ed];
1258 frame2_pos = [f_fr(1) o9 f_fr(3) o12];
1259 tics_text_pos = [ok_pb(1) o16 title_txt];
1260 tics_pos = [o20 o17 strd_ed];
1261 sel_var2_pos = [o10 o18 var_pop];
1262 labels_text_pos = [ok_pb(1) o13 title_txt];
1263 labels_pos = [o20 o14 strd_ed];
1264 sel_var1_pos = [o10 o15 var_pop];
1265 frame3_pos = [f_fr(1) o1 f_fr(3) o3];
1266 scale_text_pos = [ok_pb(1) o4 title_txt];
1267 scale_pos = [o20 o5 1.3*var_pop(1) var_pop(2)];
1268 f_fr = [7.9 8.38 216.2 36.9]; % final frame
1269 cancel_pb = [139 15.76 75.9 22.14];
1270 frame4_pos = f_fr+o25;
1271 ok_pos = ok_pb+o25;
1272 cancel_pos = cancel_pb+o25;
1273
1274 fig_h = figure( ...
1275 'Units','pixels', ...
1276 'Position', fig_pos, ...
1277 'Color',fig_color, ...
1278 'NumberTitle','off', ...
1279 'Name','recolorbar', ...
1280 'MenuBar','none', ...
1281 'Visible','off');
1282
1283 set( ...
1284 uicontrol( ... %% hint
1285 'Units','pixels', ...
1286 'BackgroundColor',fig_color, ...
1287 'HorizontalAlignment','center', ...
1288 'Position',hint_text_pos, ...
1289 'String','Options, recolorbar', ...
1290 'Style','text'),'units','normalized');
1291
1292 set( ...
1293 uicontrol( ... %% [frame]
1294 'Units','pixels', ...
1295 'Position',frame1_pos, ...
1296 'Style','frame'),'units','normalized');
1297
1298 set( ...
1299 uicontrol( ... %% In subplot(s)
1300 'Units','pixels', ...
1301 'Position',subplots_text_pos, ...
1302 'HorizontalAlignment','left', ...
1303 'String','In subplot(s)', ...
1304 'Style','text'),'units','normalized');
1305
1306 ed1_h = uicontrol( ... %% [edit]
1307 'Units','pixels', ...
1308 'BackgroundColor',bg_color2, ...
1309 'Position',subplots_pos, ...
1310 'FontSize',12, ...
1311 'Style','edit');
1312 set(ed1_h,'units','normalized');
1313
1314 set( ...
1315 uicontrol( ... %% [frame]
1316 'Units','pixels', ...
1317 'Position',frame2_pos, ...
1318 'Style','frame'),'units','normalized');
1319
1320 set( ...
1321 uicontrol( ... %% Ticks
1322 'Units','pixels', ...
1323 'Position',tics_text_pos, ...
1324 'HorizontalAlignment','left', ...
1325 'String','Ticks', ...
1326 'Style','text'),'units','normalized');
1327
1328 ed3_h = uicontrol( ... %% [edit]
1329 'Units','pixels', ...
1330 'BackgroundColor',bg_color2, ...
1331 'Position',tics_pos, ...
1332 'FontSize',12, ...
1333 'Style','edit');
1334 set(ed3_h,'units','normalized');
1335
1336 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1337 'vis_show_gui_tool(tmp(3),''select'')'];
1338 set( ...
1339 uicontrol( ... %% Select variable
1340 'Units','pixels', ...
1341 'Position',sel_var2_pos, ...
1342 'String','Select variable', ...
1343 'Callback',s),'units','normalized');
1344
1345 set( ...
1346 uicontrol( ... %% Labels (cell array)
1347 'Units','pixels', ...
1348 'Position',labels_text_pos, ...
1349 'HorizontalAlignment','left', ...
1350 'String','Labels', ...
1351 'Style','text'),'units','normalized');
1352
1353 ed2_h = uicontrol( ... %% [edit]
1354 'Units','pixels', ...
1355 'BackgroundColor',bg_color2, ...
1356 'Position',labels_pos, ...
1357 'FontSize',12, ...
1358 'Style','edit');
1359 set(ed2_h,'units','normalized');
1360
1361 s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ...
1362 'vis_show_gui_tool(tmp(2),''select'')'];
1363 set( ...
1364 uicontrol( ... %% Select variable
1365 'Units','pixels', ...
1366 'Position',sel_var1_pos, ...
1367 'String','Select variable', ...
1368 'Callback',s),'units','normalized');
1369
1370 set( ...
1371 uicontrol( ... %% [frame]
1372 'Units','pixels', ...
1373 'Position',frame3_pos, ...
1374 'Style','frame'),'units','normalized');
1375
1376 set( ...
1377 uicontrol( ... %% Scale
1378 'Units','pixels', ...
1379 'Position',scale_text_pos, ...
1380 'HorizontalAlignment','left', ...
1381 'String','Scale', ...
1382 'Style','text'),'units','normalized');
1383
1384 s = {'denormalized' 'normalized'};
1385 p1_h = uicontrol( ... %% [popupmenu]
1386 'Units','pixels', ...
1387 'Position',scale_pos, ...
1388 'String',s, ...
1389 'Style','popupmenu');
1390 set(p1_h,'units','normalized');
1391
1392 set( ...
1393 uicontrol( ... %% [frame]
1394 'Units','pixels', ...
1395 'Position',frame4_pos, ...
1396 'Style','frame'),'units','normalized');
1397
1398 s = ['vis_show_gui_tool(' mat2str(h) ',''do_recolorbar'',' mat2str(fig_h) ')'];
1399 set( ...
1400 uicontrol( ... %% OK
1401 'Units','pixels', ...
1402 'Position',ok_pos, ...
1403 'String','OK', ...
1404 'Callback',s),'units','normalized');
1405
1406 set( ...
1407 uicontrol( ... %% Cancel
1408 'Units','pixels', ...
1409 'Position',cancel_pos, ...
1410 'String','Cancel', ...
1411 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
1412
1413 watchoff(old_fig_n);
1414 tmp_udata = [ed1_h ed2_h ed3_h p1_h];
1415 set(fig_h,'units','normalized', ...
1416 'Visible','on', ...
1417 'UserData',tmp_udata, ...
1418 'handlevisibility','off');
1419
1420 %%%%%%%
1421 % clear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422 %%%%%%%
1423 elseif strcmp(action,'clear')
1424 old_fig_n = watchon;
1425 W = 232; H = 277.463;
1426 o25 = zeros(1,4);
1427 o25(1) = (W-f_fr(3))/2;
1428 f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame
1429 cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14];
1430 hint_txt = [W 18.45]; % hint text width and height
1431 units = get(h,'units');
1432 set(h,'units','pixels');
1433 fp = get(h,'Position');
1434 fig_pos = [(fp(1)+fp(3)) ...
1435 (fp(2)+fp(2)+fp(4)/2-H/2) ...
1436 W ...
1437 H];
1438 o1 = sum(f_fr([2 4]))+frames_dist;
1439 o2 = o1+dist1;
1440 o3 = (W-radio_rb(1))/2;
1441 o4 = o2+radio_rb(2)+dist1;
1442 o5 = o4+radio_rb(2)+dist1;
1443 o6 = o5+radio_rb(2)+dist1;
1444 o7 = o6+radio_rb(2)+dist1;
1445 o8 = 5*radio_rb(2)+6*dist1;
1446 o9 = o1+o8+frames_dist2;
1447 o10 = max([title_txt(2),title_edit_h]);
1448 o11 = o9+dist1+0.5*o10-title_txt(2)/2;
1449 o12 = o9+dist1+0.5*o10-strd_ed(2)/2;
1450 o20 = W-(ok_pb(1)+strd_ed(1));
1451 o13 = o10+2*dist1;
1452 o24 = o9+o13+hint_dist1;
1453 hint_text_pos = [1 o24 hint_txt];
1454 frame1_pos = [f_fr(1) o9 f_fr(3) o13];
1455 subplots_text_pos = [ok_pb(1) o11 title_txt];
1456 subplots_pos = [o20 o12 strd_ed];
1457 frame2_pos = [f_fr(1) o1 f_fr(3) o8];
1458 radiob1_pos = [o3 o7 selvar_pb];
1459 radiob2_pos = [o3 o6 selvar_pb];
1460 radiob3_pos = [o3 o5 selvar_pb];
1461 radiob4_pos = [o3 o4 selvar_pb];
1462 radiob5_pos = [o3 o2 selvar_pb];
1463 f_fr = [7.9 8.38 216.2 36.9]; % final frame
1464 cancel_pb = [139 15.76 75.9 22.14];
1465 frame3_pos = f_fr;%+o25;
1466 ok_pos = ok_pb;%+o25;
1467 cancel_pos = cancel_pb;%+o25;
1468
1469 fig_h = figure( ...
1470 'Units','pixels', ...
1471 'Position', fig_pos, ...
1472 'Color',fig_color, ...
1473 'NumberTitle','off', ...
1474 'Name','clear label', ...
1475 'MenuBar','none', ...
1476 'Visible','off');
1477
1478 set( ...
1479 uicontrol( ... %% hint
1480 'Units','pixels', ...
1481 'BackgroundColor',fig_color, ...
1482 'HorizontalAlignment','center', ...
1483 'Position',hint_text_pos, ...
1484 'String','Options for clearing', ...
1485 'Style','text'),'units','normalized');
1486
1487 set( ...
1488 uicontrol( ... %% [frame]
1489 'Units','pixels', ...
1490 'Position',frame1_pos, ...
1491 'Style','frame'),'units','normalized');
1492
1493 set( ...
1494 uicontrol( ... %% From subplots
1495 'Units','pixels', ...
1496 'Position',subplots_text_pos, ...
1497 'String','From subplots', ...
1498 'Style','text'),'units','normalized');
1499
1500 ed1_h = uicontrol( ... %% [edit]
1501 'Units','pixels', ...
1502 'BackgroundColor',bg_color2, ...
1503 'Position',subplots_pos, ...
1504 'FontSize',12, ...
1505 'Style','edit');
1506 set(ed1_h,'units','normalized');
1507
1508 set( ...
1509 uicontrol( ... %% [frame]
1510 'Units','pixels', ...
1511 'Position',frame2_pos, ...
1512 'Style','frame'),'units','normalized');
1513
1514 rb1_h = uicontrol( ... %%
1515 'Units','pixels', ...
1516 'Position',radiob1_pos, ...
1517 'style','radiobutton', ...
1518 'String','All', ...
1519 'value',1);
1520
1521 rb2_h = uicontrol( ... %%
1522 'Units','pixels', ...
1523 'Position',radiob2_pos, ...
1524 'style','radiobutton', ...
1525 'String','Comet');
1526
1527 rb3_h = uicontrol( ... %%
1528 'Units','pixels', ...
1529 'Position',radiob3_pos, ...
1530 'style','radiobutton', ...
1531 'String','Hit');
1532
1533 rb4_h = uicontrol( ... %%
1534 'Units','pixels', ...
1535 'Position',radiob4_pos, ...
1536 'style','radiobutton', ...
1537 'String','Label');
1538
1539 rb5_h = uicontrol( ... %%
1540 'Units','pixels', ...
1541 'Position',radiob5_pos, ...
1542 'style','radiobutton', ...
1543 'String','Trajectory');
1544
1545 set( ...
1546 uicontrol( ... %% [frame]
1547 'Units','pixels', ...
1548 'Position',frame3_pos, ...
1549 'Style','frame'),'units','normalized');
1550
1551 s = ['vis_show_gui_tool(' mat2str(h) ',''c_clear'',' mat2str(fig_h) ')'];
1552 set( ...
1553 uicontrol( ... %% OK
1554 'Units','pixels', ...
1555 'Position',ok_pos, ...
1556 'String','OK', ...
1557 'Callback',s),'units','normalized');
1558
1559 set( ...
1560 uicontrol( ... %% Cancel
1561 'Units','pixels', ...
1562 'Position',cancel_pos, ...
1563 'String','Cancel', ...
1564 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized');
1565
1566 watchoff(old_fig_n);
1567 tmp_udata = [ed1_h rb1_h rb2_h rb3_h rb4_h rb5_h];
1568 set(fig_h,'units','normalized', ...
1569 'Visible','on', ...
1570 'UserData',tmp_udata, ...
1571 'handlevisibility','off');
1572
1573 %%%%%%%%%
1574 % c_clear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1575 %%%%%%%%%
1576 elseif strcmp(action,'c_clear')
1577 thisfig = varargin{1};
1578 u = get(varargin{1},'UserData');
1579 s = get(u(1),'String');
1580 if ~isempty(s)
1581 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1582 sprintf(s,'[%s]',s);
1583 e = eval(s); else e = s;
1584 end
1585 if vis_valuetype(e,{'1xn','nx1','string'}),
1586 if ischar(e),
1587 if ~strcmp(e,'all'),
1588 errordlg({'Only valid string value' ...
1589 'for subplot indices is ''all''.'}, ...
1590 'Error in SOM_VIS: tools');
1591 return;
1592 else
1593 e=1:length(handles);
1594 end
1595 elseif any(e<1) | any(e>length(handles)),
1596 errordlg({'Subplot indices must be in', ...
1597 'range 1...number_of_subplots!'}, ...
1598 'Error in SOM_VIS: tools');
1599 return;
1600 end
1601 elseif ~isempty(e)
1602 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1603 return;
1604 end
1605 else,
1606 e = '';
1607 end
1608 set(0,'currentfigure',child)
1609 v = get(u(2),'value');
1610 if v,
1611 if ~isempty(e),
1612 som_show_clear('lab',e);
1613 som_show_clear('hit',e);
1614 som_show_clear('traj',e);
1615 som_show_clear('comet',e);
1616 else
1617 som_show_clear('lab');
1618 som_show_clear('hit');
1619 som_show_clear('traj');
1620 som_show_clear('comet');
1621 end
1622 end
1623 v = get(u(3),'value');
1624 if v,
1625 if ~isempty(e)
1626 som_show_clear('comet',e);
1627 else
1628 som_show_clear('comet');
1629 end
1630 end
1631 v = get(u(4),'value');
1632 if v,
1633 if ~isempty(e),
1634 som_show_clear('hit',e);
1635 else
1636 som_show_clear('hit');
1637 end
1638 end
1639 v = get(u(5),'value');
1640 if v,
1641 if ~isempty(e),
1642 som_show_clear('lab',e);
1643 else
1644 som_show_clear('lab');
1645 end
1646 end
1647 v = get(u(6),'value');
1648 if v,
1649 if ~isempty(e),
1650 som_show_clear('traj',e);
1651 else
1652 som_show_clear('traj');
1653 end
1654 end
1655 close(thisfig);
1656
1657 %%%%%%%%%%%%%%
1658 % do_recolorbar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1659 %%%%%%%%%%%%%%
1660 elseif strcmp(action,'do_recolorbar')
1661 args = {};
1662 ud = get(varargin{1},'UserData');
1663 s = get(ud(1),'String');
1664 e = 1:length(handles);
1665 if ~isempty(s)
1666 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1667 sprintf(s,'[%s]',s);
1668 e = eval(s); else e = s;
1669 end
1670 if vis_valuetype(e,{'1xn','nx1','string'}),
1671 if ischar(e) & ~strcmp(e,'all'),
1672 errordlg({'Only valid string value' ...
1673 'for subplot indices is ''all''.'}, ...
1674 'Error in SOM_VIS: tools');
1675 return;
1676 elseif any(e<1) | any(e>length(handles)),
1677 errordlg({'Subplot indices must be in', ...
1678 'range 1...number_of_subplots.'}, ...
1679 'Error in SOM_VIS: tools');
1680 return;
1681 end
1682 elseif ~isempty(e)
1683 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1684 return;
1685 end
1686 end
1687 args = [args {e}];
1688 s = get(ud(3),'String');
1689 tmp = 'auto';
1690 if strcmp(s,'auto') | strcmp(s,'border'),
1691 tmp = s;
1692 elseif ~isempty(s)
1693 tmp = evalin('base',s);
1694 end
1695 args = [args {tmp}];
1696 v = get(ud(4),'Value');
1697 s = get(ud(4),'String');
1698 args = [args {s{v}}];
1699 s = get(ud(2),'String');
1700 if ~isempty(s)
1701 args = [args {evalin('base',s)}];
1702 end
1703 thisfig = varargin{1};
1704 % set(0,'CurrentFigure',udata.vis_h);
1705 set(0,'currentfigure',child)
1706 som_recolorbar(args{:});
1707 close(thisfig);
1708
1709 %%%%%%%
1710 % label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1711 %%%%%%%
1712 elseif strcmp(action,'label')
1713 args = {'label'};
1714 ud = get(varargin{1},'UserData');
1715 s = get(ud(2),'String');
1716 if ~isempty(s)
1717 args = [args {evalin('base',s)}];
1718 else
1719 args = [args {udata.sM}];
1720 end
1721 s = get(ud(3),'String');
1722 if ~isempty(s)
1723 args = [args {'TextSize' eval(s)}];
1724 end
1725 v = get(ud(4),'Value');
1726 if v>1,
1727 s = get(ud(4),'UserData');
1728 args = [args {'TextColor' s{v}}];
1729 end
1730 s = get(ud(1),'String');
1731 if ~isempty(s)
1732 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1733 sprintf(s,'[%s]',s);
1734 e = eval(s); else e = s;
1735 end
1736 if vis_valuetype(e,{'1xn','nx1','string'}),
1737 if ischar(e),
1738 if ~strcmp(e,'all'),
1739 errordlg({'Only valid string value' ...
1740 'for subplot indices is ''all''.'}, ...
1741 'Error in SOM_VIS: tools');
1742 return;
1743 else
1744 e=1:length(handles);
1745 end
1746 elseif any(e<1) | any(e>length(handles)),
1747 errordlg({'Subplot indices must be in', ...
1748 'range 1...number_of_subplots!'}, ...
1749 'Error in SOM_VIS: tools');
1750 return;
1751 end
1752 elseif ~isempty(e)
1753 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1754 return;
1755 end
1756 args = [args {'SubPlot' e}];
1757 end
1758 thisfig = varargin{1};
1759 % set(0,'CurrentFigure',udata.vis_h);
1760 set(0,'currentfigure',child)
1761 som_show_add(args{:});
1762 close(thisfig);
1763
1764 %%%%%
1765 % hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1766 %%%%%
1767 elseif strcmp(action,'hit')
1768 args = {'hit'};
1769 ud = get(varargin{1},'UserData');
1770 s = get(ud(2),'String');
1771 e = evalin('base',s);
1772 [dummy k] = size(e);
1773 args = [args {e}];
1774 v = get(ud(10),'Value');
1775 s = get(ud(10),'UserData');
1776 args = [args {'EdgeColor' s{v}}];
1777 %
1778 s = get(ud(7),'String');
1779 if ~isempty(s)
1780 args = [args {'MarkerSize' eval(s)}];
1781 end
1782 if k == 1,
1783 v = get(ud(6),'Value');
1784 if v<16,
1785 s = get(ud(6),'String');
1786 args = [args {'Marker' s{v}}];
1787 else
1788 % errordlg();
1789 return;
1790 end
1791 v = get(ud(9),'Value');
1792 if v<10,
1793 s = get(ud(9),'UserData');
1794 args = [args {'MarkerColor' s{v}}];
1795 else
1796 % errordlg();
1797 return;
1798 end
1799 %
1800 v = get(ud(5),'Value');
1801 s = get(ud(5),'String');
1802 args = [args {'Text' s{v}}];
1803 if v>1, % 1='off'
1804 v = get(ud(3),'Value');
1805 s = get(ud(3),'UserData');
1806 args = [args {'TextColor' s{v}}];
1807 %
1808 s = get(ud(4),'String');
1809 args = [args {'TextSize' eval(s)}];
1810 end
1811 else
1812 v = get(ud(8),'Value');
1813 s = get(ud(8),'String');
1814 args = [args {'SizeFactor' s{v}}];
1815 %
1816 v = get(ud(6),'Value');
1817 s = get(ud(6),'String');
1818 args = [args {'Marker' s{v}}];
1819 %
1820 v = get(ud(9),'Value');
1821 s = get(ud(9),'UserData');
1822 args = [args {'MarkerColor' s{v}}];
1823 end
1824
1825 s = get(ud(1),'String');
1826 if ~isempty(s)
1827 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1828 sprintf(s,'[%s]',s);
1829 e = eval(s); else e = s;
1830 end
1831 if vis_valuetype(e,{'1xn','nx1','string'}),
1832 if ischar(e),
1833 if ~strcmp(e,'all'),
1834 errordlg({'Only valid string value' ...
1835 'for subplot indices is ''all''.'}, ...
1836 'Error in SOM_VIS: tools');
1837 return;
1838 else
1839 e=1:length(handles);
1840 end
1841 elseif any(e<1) | any(e>length(handles)),
1842 errordlg({'Subplot indices must be in', ...
1843 'range 1...number_of_subplots!'}, ...
1844 'Error in SOM_VIS: tools');
1845 return;
1846 end
1847 elseif ~isempty(e)
1848 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1849 return;
1850 end
1851 args = [args {'SubPlot' e}];
1852 end
1853 thisfig = varargin{1};
1854 % set(0,'CurrentFigure',udata.vis_h);
1855 set(0,'currentfigure',child)
1856 som_show_add(args{:});
1857 close(thisfig);
1858
1859 %%%%%%
1860 % traj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1861 %%%%%%
1862 elseif strcmp(action,'traj')
1863 args = {'traj'};
1864 ud = get(varargin{1},'UserData');
1865 s = get(ud(2),'String');
1866 args = [args {evalin('base',s)}];
1867 s = get(ud(4),'String');
1868 if ~isempty(s)
1869 args = [args {'TrajWidth' eval(s)}];
1870 end
1871 v = get(ud(5),'Value');
1872 if v>1,
1873 s = get(ud(5),'String');
1874 args = [args {'WidthFactor' s{v}}];
1875 end
1876 v = get(ud(3),'Value');
1877 if v>1,
1878 s = get(ud(3),'UserData');
1879 args = [args {'TrajColor' s{v}}];
1880 end
1881 v = get(ud(6),'Value');
1882 if v>1,
1883 s = get(ud(6),'String');
1884 args = [args {'Marker' s{v}}];
1885 end
1886 s = get(ud(7),'String');
1887 if ~isempty(s)
1888 args = [args {'MarkerSize' eval(s)}];
1889 end
1890 v = get(ud(8),'Value');
1891 if v>1,
1892 s = get(ud(8),'String');
1893 args = [args {'SizeFactor' s{v}}];
1894 end
1895 v = get(ud(9),'Value');
1896 if v>1,
1897 s = get(ud(9),'UserData');
1898 args = [args {'MarkerColor' s{v}}];
1899 end
1900 v = get(ud(10),'Value');
1901 if v>1,
1902 s = get(ud(10),'UserData');
1903 args = [args {'EdgeColor' s{v}}];
1904 end
1905 s = get(ud(1),'String');
1906 if ~isempty(s)
1907 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1908 sprintf(s,'[%s]',s);
1909 e = eval(s); else e = s;
1910 end
1911 if vis_valuetype(e,{'1xn','nx1','string'}),
1912 if ischar(e),
1913 if ~strcmp(e,'all'),
1914 errordlg({'Only valid string value' ...
1915 'for subplot indices is ''all''.'}, ...
1916 'Error in SOM_VIS: tools');
1917 return;
1918 else
1919 e=1:length(handles);
1920 end
1921 elseif any(e<1) | any(e>length(handles)),
1922 errordlg({'Subplot indices must be in', ...
1923 'range 1...number_of_subplots!'}, ...
1924 'Error in SOM_VIS: tools');
1925 return;
1926 end
1927 elseif ~isempty(e)
1928 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1929 return;
1930 end
1931 args = [args {'SubPlot' e}];
1932 end
1933 thisfig = varargin{1};
1934 % set(0,'CurrentFigure',udata.vis_h);
1935 set(0,'currentfigure',child)
1936 som_show_add(args{:});
1937 close(thisfig);
1938
1939 %%%%%%%
1940 % comet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1941 %%%%%%%
1942 elseif strcmp(action,'comet')
1943 args = {'comet'};
1944 ud = get(varargin{1},'UserData');
1945 s = get(ud(2),'String');
1946 args = [args {evalin('base',s)}];
1947 v = get(ud(3),'Value');
1948 if v>1,
1949 s = get(ud(3),'String');
1950 args = [args {'Marker' s{v}}];
1951 end
1952 s = get(ud(4),'String');
1953 if ~isempty(s)
1954 args = [args {'MarkerSize' eval(s)}];
1955 end
1956 v = get(ud(5),'Value');
1957 s = get(ud(5),'UserData');
1958 if v==10,
1959 args = [args {'MarkerColor' evalin('base',s{10})}];
1960 else
1961 args = [args {'MarkerColor' s{v}}];
1962 end
1963 v = get(ud(6),'Value');
1964 if v>1,
1965 s = get(ud(6),'UserData');
1966 args = [args {'EdgeColor' s{v}}];
1967 end
1968 s = get(ud(1),'String');
1969 if ~isempty(s)
1970 if s(1)=='[' | (s(1)>='1' & s(1)<='9')
1971 sprintf(s,'[%s]',s);
1972 e = eval(s); else e = s;
1973 end
1974 if vis_valuetype(e,{'1xn','nx1','string'}),
1975 if ischar(e),
1976 if ~strcmp(e,'all'),
1977 errordlg({'Only valid string value' ...
1978 'for subplot indices is ''all''.'}, ...
1979 'Error in SOM_VIS: tools');
1980 return;
1981 else
1982 e=1:length(handles);
1983 end
1984 elseif any(e<1) | any(e>length(handles)),
1985 errordlg({'Subplot indices must be in', ...
1986 'range 1...number_of_subplots!'}, ...
1987 'Error in SOM_VIS: tools');
1988 return;
1989 end
1990 elseif ~isempty(e)
1991 errordlg('Invalid subplot indices!','Error in SOM_VIS: tools');
1992 return;
1993 end
1994 args = [args {'SubPlot' e}];
1995 end
1996 thisfig = varargin{1};
1997 % set(0,'CurrentFigure',udata.vis_h);
1998 set(0,'currentfigure',child)
1999 som_show_add(args{:});
2000 close(thisfig);
2001
2002 %%%%%%%%
2003 % select %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2004 %%%%%%%%
2005 elseif strcmp(action,'select')
2006 %% NOTE: input h is not main_gui_handle
2007 %% but edit menu handle
2008 w = evalin('base','whos');
2009 for (i=1:length(w))
2010 size_frst{i} = mat2str(w(i).size(1));
2011 x(i,1) = 'x';
2012 size_scnd{i} = mat2str(w(i).size(2));
2013 end
2014 names = strvcat(w.name);
2015 [dummy vert] = size(names);
2016 for (i=1:length(w))
2017 for (j=1:8)
2018 sp(i,j) = ' ';
2019 end
2020 end
2021 size_M = strjust(strvcat(size_frst{:}),'right');
2022 size_N = strjust(strvcat(size_scnd{:}),'left');
2023 classes = strvcat(w.class);
2024 s = [cellstr([names sp size_M x size_N sp classes])]';
2025
2026 [sel,ok] = listdlg('ListString',s,...
2027 'Name','Variable selection',...
2028 'PromptString','Select variable', ...
2029 'SelectionMode','single');
2030 if ok & ~isempty(sel),
2031 w = {w.name};
2032 if ishandle(h),
2033 set(h,'String',w{sel});
2034 elseif nargout==1,
2035 r = w{sel};
2036 end
2037 elseif nargout==1,
2038 r = '';
2039 end
2040
2041 %%%%%%%%%%%%%%
2042 % popup_select %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2043 %%%%%%%%%%%%%%
2044 elseif strcmp(action,'popup_select')
2045 %% NOTE: input h is not main_gui_handle
2046 %% but h(1) is popupmenu handle and h(2:end) are indeces
2047 v = get(h(1),'Value');
2048 if any(v==h(2:end)),
2049 w = evalin('base','whos');
2050 for (i=1:length(w))
2051 size_frst{i} = mat2str(w(i).size(1));
2052 x(i,1) = 'x';
2053 size_scnd{i} = mat2str(w(i).size(2));
2054 end
2055 names = strvcat(w.name);
2056 [dummy vert] = size(names);
2057 for (i=1:length(w))
2058 for (j=1:8)
2059 sp(i,j) = ' ';
2060 end
2061 end
2062 size_M = strjust(strvcat(size_frst{:}),'right');
2063 size_N = strjust(strvcat(size_scnd{:}),'left');
2064 classes = strvcat(w.class);
2065 s = [cellstr([names sp size_M x size_N sp classes])]';
2066 [sel,ok] = listdlg('ListString',s,...
2067 'Name','Variable selection',...
2068 'PromptString','Select variable', ...
2069 'SelectionMode','single');
2070 if ok & ~isempty(sel),
2071 w = {w.name};
2072 i = find(v==h(2:end));
2073 s = get(h(1),'String');
2074 s{h(i+1)} = w{sel};
2075 set(h(1),'String',s);
2076 if nargout==1,
2077 r = w{sel};
2078 end
2079 elseif nargout==1,
2080 r = '';
2081 end
2082 end
2083
2084 end
2085