Daniel@0: function r=vis_show_gui_tool(h,action,varargin) Daniel@0: Daniel@0: %VIS_SHOW_GUI_TOOL is a subfunction of SOM_SHOW_GUI. Daniel@0: % Daniel@0: % r = vis_show_gui_tool(handle, action, varargin) Daniel@0: % Daniel@0: % Input arguments: Daniel@0: % handle (struct) Daniel@0: % action (string) Daniel@0: % varargin (varies) Daniel@0: % Daniel@0: % See also SOM_SHOW_GUI. Daniel@0: Daniel@0: % Copyright (c) 2000 by Roman Feldman and Juha Vesanto Daniel@0: % Contributed to SOM Toolbox on August 22nd, 2000 Daniel@0: % http://www.cis.hut.fi/projects/somtoolbox/ Daniel@0: Daniel@0: % Version 2.0beta roman 160800 juuso 220800 Daniel@0: Daniel@0: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: Daniel@0: if ishandle(h(1)), Daniel@0: udata = get(h(1),'UserData'); Daniel@0: if isfield(udata,'plot_array'), Daniel@0: plot_array = udata.plot_array; Daniel@0: if isfield(udata,'vis_h') Daniel@0: % get most recent plotted Daniel@0: children = get(0,'children'); Daniel@0: % first refresh plot info Daniel@0: udata.vis_h = setdiff(udata.vis_h,setdiff(udata.vis_h,children)); Daniel@0: set(h(1),'userdata',udata); Daniel@0: for i=1:length(children), Daniel@0: if any(children(i)==udata.vis_h), Daniel@0: child = children(i); Daniel@0: [handles,msg,lattice,msize,dim]=vis_som_show_data('all',children(i)); Daniel@0: break; Daniel@0: elseif i==length(children), Daniel@0: errordlg({'Plot not found', ... Daniel@0: 'Try to visualize first'},'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: end Daniel@0: else Daniel@0: errordlg({'Plot not found', ... Daniel@0: 'Try to visualize first'},'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: end Daniel@0: end Daniel@0: Daniel@0: %--- color vars --- Daniel@0: fig_color = [0.8 0.8 0.8]; Daniel@0: bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725]; Daniel@0: bg_color2 = [0.9 0.9 0.9]; Daniel@0: %--- object position vars (in pixels) --- Daniel@0: % calculations based on case 'comp' Daniel@0: %% hint text Daniel@0: hint_dist1 = 98.17-(61.27+36.9); % hint text lower edge and next lower frame upper edge Daniel@0: hint_dist2 = 123-(98.17+18.45); % figure upper edge and hint text upper edge Daniel@0: %% general Daniel@0: dist1 = 67.42-61.27; % general distance between frame edge and object in frame Daniel@0: %% frame + ok / cancel Daniel@0: frames_dist = 61.27-(8.38+36.9); Daniel@0: frames_dist2 = 8.38; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: ok_pb = [17.1 15.76 75.9 22.14]; Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: %% objects Daniel@0: hint_txt = [460 18.45]; % hint text width and height Daniel@0: interp_cb = [98.9 24.6]; Daniel@0: title_txt = [90 hint_txt(2)-3]; Daniel@0: title_edit_h = 23.083; Daniel@0: var_pop = [interp_cb(1) ok_pb(4)]; Daniel@0: list_lt = [130 130]; Daniel@0: calc_txt = [list_lt(1) hint_txt(2)]; Daniel@0: selvar_pb = [110 ok_pb(4)]; Daniel@0: strd_ed = [var_pop(1) title_edit_h]; Daniel@0: radio_rb = selvar_pb; Daniel@0: Daniel@0: %%%%%%%%%%% Daniel@0: % add_label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%%% Daniel@0: if strcmp(action,'add_label') Daniel@0: old_fig_n = watchon; Daniel@0: W = 345.4; H = 222.769; Daniel@0: o21 = zeros(1,4); Daniel@0: o21(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = 4*dist1+2*max([title_edit_h,title_txt(2)]) ... Daniel@0: +max([title_txt(2),var_pop(2)]); Daniel@0: o6 = max([title_txt(2),var_pop(2)]); Daniel@0: o7 = max([title_txt(2),title_edit_h]); Daniel@0: o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]); Daniel@0: o3 = o1+0.5*o6+dist1-title_txt(2)/2; Daniel@0: o4 = o1+0.5*o6+dist1-var_pop(2)/2; Daniel@0: o5 = ok_pb(1)+title_txt(1); Daniel@0: o9 = o1+o6+0.5*o7+2*dist1-title_txt(2)/2; Daniel@0: o10 = o1+o6+0.5*o7+2*dist1-title_edit_h/2;; Daniel@0: o11 = o1+o6+o7+0.5*o8+3*dist1-title_txt(2)/2; Daniel@0: o12 = o1+o6+o7+0.5*o8+3*dist1-title_edit_h/2; Daniel@0: o13 = o1+o6+o7+0.5*o8+3*dist1-selvar_pb(2)/2; Daniel@0: o15 = o1+o2+frames_dist2; Daniel@0: o16 = 2*dist1+o7; Daniel@0: o17 = o5+strd_ed(1)+2*dist1; % W-ok_pb(1)-selvar_pb(1); Daniel@0: o18 = o15+0.5*o7+dist1-title_txt(2)/2; Daniel@0: o19 = o15+0.5*o7+dist1-title_edit_h/2; Daniel@0: o20 = o15+o16+hint_dist1; Daniel@0: hint_text_pos = [1 o20 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o15 f_fr(3) o16]; Daniel@0: subplots_text_pos = [ok_pb(1) o18 title_txt]; Daniel@0: subplots_pos = [o5 o19 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o1 f_fr(3) o2]; Daniel@0: labels_text_pos = [ok_pb(1) o11 title_txt]; Daniel@0: labels_pos = [o5 o12 strd_ed]; Daniel@0: sel_var_pos = [o17 o13 selvar_pb]; Daniel@0: text_size_text_pos = [ok_pb(1) o9 title_txt]; Daniel@0: text_size_pos = [o5 o10 strd_ed]; Daniel@0: text_color_text_pos = [ok_pb(1) o3 title_txt]; Daniel@0: text_color_pos = [o5 o4 var_pop]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame3_pos = f_fr+o21; Daniel@0: ok_pos = ok_pb+o21; Daniel@0: cancel_pos = cancel_pb+o21; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','add label', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options for adding labels', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% To subplot(s) Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','To subplot(s)', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Labels Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',labels_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Labels', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed2_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',labels_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed2_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(2),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_var_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text size Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_size_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text size', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed3_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',text_size_pos, ... Daniel@0: 'String','10', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text color Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor' 'none'}; Daniel@0: s = {'black' 'white' 'yellow' 'magenta' 'cyan' 'red' 'green' ... Daniel@0: 'blue' 'xor' 'none'}; Daniel@0: p_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''label'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: ud = [ed1_h ed2_h ed3_h p_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',ud, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%%%% Daniel@0: % add_hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%% Daniel@0: elseif strcmp(action,'add_hit') Daniel@0: old_fig_n = watchon; Daniel@0: W = 424.3; H = 337.642; Daniel@0: o37 = zeros(1,4); Daniel@0: o37(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = o1+dist1; Daniel@0: o6 = max([title_txt(2),var_pop(2)]); Daniel@0: o7 = max([title_txt(2),title_edit_h]); Daniel@0: o8 = max([title_txt(2),title_edit_h,var_pop(2)]); Daniel@0: o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]); Daniel@0: o3 = o8+o6+3*dist1; Daniel@0: o4 = o1+0.5*o8+dist1-title_txt(2)/2; Daniel@0: o5 = o1+0.5*o8+dist1-var_pop(2)/2; Daniel@0: o9 = o1+0.5*o8+dist1-title_edit_h/2; Daniel@0: o21 = o1+o8+0.5*o6+2*dist1-title_txt(2)/2; Daniel@0: o22 = o1+o8+0.5*o6+2*dist1-var_pop(2)/2; Daniel@0: o20 = ok_pb(1)+title_txt(1); Daniel@0: o10 = o20+var_pop(1)+2*dist1; Daniel@0: o11 = o10+title_txt(1); Daniel@0: o12 = o2+o8+dist1+0.5*o6-title_txt(2)/2; Daniel@0: o13 = o2+o8+dist1+0.5*o6-var_pop(2)/2; Daniel@0: o14 = o1+o3+frames_dist2; Daniel@0: o15 = 2*o6+o8+4*dist1; Daniel@0: o16 = o14+dist1+0.5*o6-title_txt(2)/2; Daniel@0: o17 = o14+dist1+0.5*o6-var_pop(2)/2; Daniel@0: o18 = o14+o6+2*dist1+0.5*o8-title_txt(2)/2; Daniel@0: o19 = o14+o6+2*dist1+0.5*o8-title_edit_h/2; Daniel@0: o23 = o14+o6+2*dist1+0.5*o8-var_pop(2)/2; Daniel@0: o24 = o14+o6+3*dist1+o8+0.5*o6-title_txt(2)/2; Daniel@0: o25 = o14+o6+3*dist1+o8+0.5*o6-var_pop(2)/2; Daniel@0: o26 = o14+o15+frames_dist2; Daniel@0: o27 = o8+2*dist1; Daniel@0: o28 = o26+dist1+0.5*o38-title_txt(2)/2; Daniel@0: o29 = o26+dist1+0.5*o38-title_edit_h/2; Daniel@0: o30 = o26+dist1+0.5*o38-selvar_pb(2)/2; Daniel@0: o31 = o10; %W-(ok_pb(1)+selvar_pb(1)); Daniel@0: o32 = o26+o27+frames_dist2; Daniel@0: o33 = o7+2*dist1; Daniel@0: o34 = o32+dist1+0.5*o7-title_txt(2)/2; Daniel@0: o35 = o32+dist1+0.5*o7-title_edit_h/2; Daniel@0: o36 = o32+o33+hint_dist1; Daniel@0: hint_text_pos = [1 o36 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o32 f_fr(3) o33]; Daniel@0: subplots_text_pos = [ok_pb(1) o34 title_txt]; Daniel@0: subplots_pos = [o20 o35 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o26 f_fr(3) o27]; Daniel@0: trace_vect_text_pos = [ok_pb(1) o28 title_txt]; Daniel@0: trace_vect_pos = [o20 o29 strd_ed]; Daniel@0: sel_vect_pos = [o31 o30 selvar_pb]; Daniel@0: frame3_pos = [f_fr(1) o14 f_fr(3) o15]; Daniel@0: marker_text_pos = [ok_pb(1) o24 title_txt]; Daniel@0: marker_pos = [o20 o25 var_pop]; Daniel@0: marker_size_text_pos = [ok_pb(1) o18 title_txt]; Daniel@0: marker_size_pos = [o20 o19 strd_ed]; Daniel@0: size_fact_text_pos = [o10 o18 title_txt]; Daniel@0: size_fact_pos = [o11 o23 var_pop]; Daniel@0: marker_color_text_pos = [ok_pb(1) o16 title_txt]; Daniel@0: marker_color_pos = [o20 o17 var_pop]; Daniel@0: edge_color_text_pos = [o10 o16 title_txt]; Daniel@0: edge_color_pos = [o11 o17 var_pop]; Daniel@0: frame4_pos = [f_fr(1) o1 f_fr(3) o3]; Daniel@0: text_text_pos = [ok_pb(1) o21 title_txt]; Daniel@0: text_pos = [o20 o22 var_pop]; Daniel@0: text_color_text_pos = [ok_pb(1) o4 title_txt]; Daniel@0: text_color_pos = [o20 o5 var_pop]; Daniel@0: text_size_text_pos = [o10 o4 title_txt]; Daniel@0: text_size_pos = [o11 o9 strd_ed]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame5_pos = f_fr+o37; Daniel@0: ok_pos = ok_pb+o37; Daniel@0: cancel_pos = cancel_pb+o37; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','add hit histogram', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options for adding hit histogram', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% To subplot(s) Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','To subplot(s)', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Trace vector Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',trace_vect_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Hit vector', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed2_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',trace_vect_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed2_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(2),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_vect_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Marker', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'lattice' 'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ... Daniel@0: '<' '>' 'p' 'h' 'none' 'cell array'}; Daniel@0: p3_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool([tmp(6),16],''popup_select'')']; Daniel@0: set(p3_h,'units','normalized','Callback',s); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker size Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_size_text_pos, ... Daniel@0: 'String','Marker size', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed4_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',marker_size_pos, ... Daniel@0: 'String','12', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed4_h,'units','normalized','Callback',s); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Size factor Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',size_fact_text_pos, ... Daniel@0: 'String','Size factor', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'common' 'separate'}; Daniel@0: p4_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',size_fact_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p4_h,'units','normalized'); Daniel@0: Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker color Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_color_text_pos, ... Daniel@0: 'String','Marker color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''}; Daniel@0: s = {'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue' 'none' '-matrix-'}; Daniel@0: p5_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool([tmp(9) 10],''popup_select'')']; Daniel@0: set(p5_h,'units','normalized','Callback',s); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% EdgeColor Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Edge color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'}; Daniel@0: s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue'}; Daniel@0: p6_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p6_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame4_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'off' 'on'}; Daniel@0: p2_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p2_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'off' 'on'}; Daniel@0: p2_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p2_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text color Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'k' 'w' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'}; Daniel@0: s = {'black' 'white' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue' 'xor'}; Daniel@0: p1_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Text size Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',text_size_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Text size', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed3_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',text_size_pos, ... Daniel@0: 'String','3', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame5_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''hit'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',tmp_udata, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%%%%% Daniel@0: % add_traj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%% Daniel@0: elseif strcmp(action,'add_traj') Daniel@0: old_fig_n = watchon; Daniel@0: W = 424.3; H = 337.642; Daniel@0: o34 = zeros(1,4); Daniel@0: o34(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = o1+dist1; Daniel@0: o6 = max([title_txt(2),var_pop(2)]); Daniel@0: o7 = max([title_txt(2),title_edit_h]); Daniel@0: o8 = max([title_txt(2),title_edit_h,var_pop(2)]); Daniel@0: o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]); Daniel@0: o20 = ok_pb(1)+title_txt(1); Daniel@0: o10 = o20+var_pop(1)+2*dist1; Daniel@0: o11 = o10+title_txt(1); Daniel@0: o3 = 2*o6+o8+4*dist1; Daniel@0: o4 = o1+dist1+0.5*o6-title_txt(2)/2; Daniel@0: o5 = o1+dist1+0.5*o6-var_pop(2)/2; Daniel@0: o9 = o1+2*dist1+o6+0.5*o8-title_txt(2)/2; Daniel@0: o12 = o1+2*dist1+o6+0.5*o8-title_edit_h/2; Daniel@0: o13 = o1+2*dist1+o6+0.5*o8-var_pop(2)/2; Daniel@0: o14 = o1+3*dist1+o6+o8+0.5*o6-title_edit_h/2; Daniel@0: o15 = o1+3*dist1+o6+o8+0.5*o6-var_pop(2)/2; Daniel@0: o16 = o1+o3+frames_dist2; Daniel@0: o17 = o8+o6+3*dist1; Daniel@0: o18 = o16+dist1+0.5*o8-title_txt(2)/2; Daniel@0: o19 = o16+dist1+0.5*o8-title_edit_h/2; Daniel@0: o21 = o16+dist1+0.5*o8-var_pop(2)/2; Daniel@0: o22 = o16+2*dist1+o8+0.5*o6-title_txt(2)/2; Daniel@0: o23 = o16+2*dist1+o8+0.5*o6-var_pop(2)/2; Daniel@0: o24 = o16+o17+frames_dist2; Daniel@0: o25 = o38+2*dist1; Daniel@0: o26 = o24+dist1+0.5*o38-title_txt(2)/2; Daniel@0: o27 = o24+dist1+0.5*o38-title_edit_h/2; Daniel@0: o28 = o24+dist1+0.5*o38-selvar_pb(2)/2; Daniel@0: o29 = o24+o25+frames_dist2; Daniel@0: o30 = o7+2*dist1; Daniel@0: o31 = o29+dist1+0.5*o7-title_txt(2)/2; Daniel@0: o32 = o29+dist1+0.5*o7-title_edit_h/2; Daniel@0: o33 = o29+o30+hint_dist1; Daniel@0: hint_text_pos = [1 o33 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o29 f_fr(3) o30]; Daniel@0: subplots_text_pos = [ok_pb(1) o31 title_txt]; Daniel@0: subplots_pos = [o20 o32 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o24 f_fr(3) o25]; Daniel@0: trace_vect_text_pos = [ok_pb(1) o26 title_txt]; Daniel@0: trace_vect_pos = [o20 o27 strd_ed]; Daniel@0: sel_vect_pos = [o10 o28 selvar_pb]; Daniel@0: frame3_pos = [f_fr(1) o16 f_fr(3) o17]; Daniel@0: line_color_text_pos = [ok_pb(1) o22 title_txt]; Daniel@0: line_color_pos = [o20 o23 var_pop]; Daniel@0: line_width_text_pos = [ok_pb(1) o18 title_txt]; Daniel@0: line_width_pos = [o20 o19 strd_ed]; Daniel@0: width_factor_text_pos = [o10 o18 title_txt]; Daniel@0: width_factor_pos = [o11 o19 var_pop]; Daniel@0: frame4_pos = [f_fr(1) o1 f_fr(3) o3]; Daniel@0: marker_text_pos = [ok_pb(1) o14 title_txt]; Daniel@0: marker_pos = [o20 o15 var_pop]; Daniel@0: marker_size_text_pos = [ok_pb(1) o9 title_txt]; Daniel@0: marker_size_pos = [o20 o12 strd_ed]; Daniel@0: size_factor_text_pos = [o10 o9 title_txt]; Daniel@0: size_factor_pos = [o11 o13 var_pop]; Daniel@0: marker_color_text_pos = [ok_pb(1) o4 title_txt]; Daniel@0: marker_color_pos = [o20 o5 var_pop]; Daniel@0: edge_color_text_pos = [o10 o4 title_txt]; Daniel@0: edge_color_pos = [o11 o5 var_pop]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame5_pos = f_fr+o34; Daniel@0: ok_pos = ok_pb+o34; Daniel@0: cancel_pos = cancel_pb+o34; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','add trajectory', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options for adding trajectory', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... Daniel@0: 'Units','pixels', ... %% To subplot(s) Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','To subplot(s)', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Trace vector Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',trace_vect_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Trajectory', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed2_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',trace_vect_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed2_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(2),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_vect_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Line color Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',line_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Line color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'xor'}; Daniel@0: s = {'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue' 'xor'}; Daniel@0: p1_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',line_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Line width Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',line_width_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Line width', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed3_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',line_width_pos, ... Daniel@0: 'String','3', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Factor Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',width_factor_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Factor', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'hit' 'equal'}; Daniel@0: p2_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',width_factor_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p2_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame4_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Marker', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ... Daniel@0: '<' '>' 'p' 'h' 'none'}; Daniel@0: p3_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker size Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_size_text_pos, ... Daniel@0: 'String','Marker size', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed4_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',marker_size_pos, ... Daniel@0: 'String','10', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed4_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Factor Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',size_factor_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Factor', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'hit' 'equal'}; Daniel@0: p4_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',size_factor_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p4_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker color Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_color_text_pos, ... Daniel@0: 'String','Marker color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none'}; Daniel@0: s = {'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue' 'none'}; Daniel@0: p5_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p5_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Edge color Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Edge color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'}; Daniel@0: s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue'}; Daniel@0: p6_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p6_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame5_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''traj'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h ed4_h p4_h p5_h p6_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',tmp_udata, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%%%%%% Daniel@0: % add_comet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%%% Daniel@0: elseif strcmp(action,'add_comet') Daniel@0: old_fig_n = watchon; Daniel@0: W = 424.3; H = 265.589; Daniel@0: o26 = zeros(1,4); Daniel@0: o26(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = o1+dist1; Daniel@0: o6 = max([title_txt(2),var_pop(2)]); Daniel@0: o7 = max([title_txt(2),title_edit_h]); Daniel@0: o8 = max([title_txt(2),title_edit_h,var_pop(2)]); Daniel@0: o38 = max([title_txt(2),title_edit_h,selvar_pb(2)]); Daniel@0: o20 = ok_pb(1)+title_txt(1); Daniel@0: o10 = o20+var_pop(1)+2*dist1; Daniel@0: o11 = o10+title_txt(1); Daniel@0: o3 = 2*o6+o7+4*dist1; Daniel@0: o4 = o1+dist1+0.5*o6-title_txt(2)/2; Daniel@0: o5 = o1+dist1+0.5*o6-var_pop(2)/2; Daniel@0: o9 = o1+2*dist1+o6+0.5*o7-title_txt(2)/2; Daniel@0: o12 = o1+2*dist1+o6+0.5*o7-title_edit_h/2; Daniel@0: o13 = o1+3*dist1+o7+1.5*o6-title_txt(2)/2; Daniel@0: o14 = o1+3*dist1+o7+1.5*o6-var_pop(2)/2; Daniel@0: o15 = o1+o3+frames_dist2; Daniel@0: o16 = o38+2*dist1; Daniel@0: o17 = o15+dist1+0.5*o38-title_txt(2)/2; Daniel@0: o18 = o15+dist1+0.5*o38-title_edit_h/2; Daniel@0: o19 = o15+dist1+0.5*o38-selvar_pb(2)/2; Daniel@0: o21 = o15+o16+frames_dist2; Daniel@0: o22 = o7+2*dist1; Daniel@0: o23 = o21+dist1+0.5*o7-title_txt(2)/2; Daniel@0: o24 = o21+dist1+0.5*o7-title_edit_h/2; Daniel@0: o25 = o21+o22+hint_dist1; Daniel@0: hint_text_pos = [1 o25 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o21 f_fr(3) o22]; Daniel@0: subplots_text_pos = [ok_pb(1) o23 title_txt]; Daniel@0: subplots_pos = [o20 o24 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o15 f_fr(3) o16]; Daniel@0: trace_vect_text_pos = [ok_pb(1) o17 title_txt]; Daniel@0: trace_vect_pos = [o20 o18 strd_ed]; Daniel@0: sel_var_pos = [o10 o19 selvar_pb]; Daniel@0: frame3_pos = [f_fr(1) o1 f_fr(3) o3]; Daniel@0: marker_text_pos = [ok_pb(1) o13 title_txt]; Daniel@0: marker_pos = [o20 o14 var_pop]; Daniel@0: marker_size_text_pos = [ok_pb(1) o9 title_txt]; Daniel@0: marker_size_pos = [o20 o12 var_pop]; Daniel@0: marker_color_text_pos = [ok_pb(1) o4 title_txt]; Daniel@0: marker_color_pos = [o20 o5 var_pop]; Daniel@0: edge_color_text_pos = [o10 o4 title_txt]; Daniel@0: edge_color_pos = [o11 o5 var_pop]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame4_pos = f_fr+o26; Daniel@0: ok_pos = ok_pb+o26; Daniel@0: cancel_pos = cancel_pb+o26; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','add comet', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options for adding comet', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% To subplot(s) Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','To subplot(s)', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Trace vector Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',trace_vect_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Trace vector', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed2_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',trace_vect_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed2_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(2),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_var_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Marker', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'o' '.' 'x' '+' '*' 's' 'd' 'v' '^' ... Daniel@0: '<' '>' 'p' 'h' 'lattice' 'none'}; Daniel@0: p1_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker size Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_size_text_pos, ... Daniel@0: 'String','Marker size', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed3_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',marker_size_pos, ... Daniel@0: 'String','[20 4]', ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Marker color Daniel@0: 'Units','pixels', ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'Position',marker_color_text_pos, ... Daniel@0: 'String','Marker color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b' 'none' ''}; Daniel@0: s = {'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue' 'none' '-matrix-'}; Daniel@0: p2_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',marker_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool([tmp(5) 10],''popup_select'')']; Daniel@0: set(p2_h,'units','normalized','Callback',s); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Edge color Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Edge color', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ud = {'none' 'w' 'k' 'y' 'm' 'c' 'r' 'g' 'b'}; Daniel@0: s = {'none' 'white' 'black' 'yellow' 'magenta' 'cyan' ... Daniel@0: 'red' 'green' 'blue'}; Daniel@0: p3_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',edge_color_pos, ... Daniel@0: 'UserData',ud, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p3_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame4_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''comet'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: tmp_udata = [ed1_h ed2_h p1_h ed3_h p2_h p3_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',tmp_udata, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%%%%%%% Daniel@0: % recolorbar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%%%% Daniel@0: elseif strcmp(action,'recolorbar') Daniel@0: old_fig_n = watchon; Daniel@0: W = 345.4; H = 237.299; Daniel@0: o25 = zeros(1,4); Daniel@0: o25(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = o1+dist1; Daniel@0: o6 = max([title_txt(2),var_pop(2)]); Daniel@0: o7 = max([title_txt(2),title_edit_h]); Daniel@0: o8 = max([title_txt(2),title_edit_h,selvar_pb(2)]); Daniel@0: o20 = ok_pb(1)+title_txt(1); Daniel@0: o10 = o20+var_pop(1)+2*dist1; Daniel@0: o11 = o10+title_txt(1); Daniel@0: o3 = o6+2*dist1; Daniel@0: o4 = o1+dist1+0.5*o6-title_txt(2)/2; Daniel@0: o5 = o1+dist1+0.5*o6-var_pop(2)/2; Daniel@0: o9 = o1+o3+frames_dist2; Daniel@0: o12 = 2*o8+3*dist1; Daniel@0: o13 = o9+dist1+0.5*o8-title_txt(2)/2; Daniel@0: o14 = o9+dist1+0.5*o8-title_edit_h/2; Daniel@0: o15 = o9+dist1+0.5*o8-var_pop(2)/2; Daniel@0: o16 = o9+2*dist1+1.5*o8-title_txt(2)/2; Daniel@0: o17 = o9+2*dist1+1.5*o8-title_edit_h/2; Daniel@0: o18 = o9+2*dist1+1.5*o8-var_pop(2)/2; Daniel@0: o19 = o9+o12+frames_dist2; Daniel@0: o21 = o7+2*dist1; Daniel@0: o22 = o19+dist1+0.5*o7-title_txt(2)/2; Daniel@0: o23 = o19+dist1+0.5*o7-title_edit_h/2; Daniel@0: o24 = o19+o21+hint_dist1; Daniel@0: hint_text_pos = [1 o24 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o19 f_fr(3) o21]; Daniel@0: subplots_text_pos = [ok_pb(1) o22 title_txt]; Daniel@0: subplots_pos = [o20 o23 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o9 f_fr(3) o12]; Daniel@0: tics_text_pos = [ok_pb(1) o16 title_txt]; Daniel@0: tics_pos = [o20 o17 strd_ed]; Daniel@0: sel_var2_pos = [o10 o18 var_pop]; Daniel@0: labels_text_pos = [ok_pb(1) o13 title_txt]; Daniel@0: labels_pos = [o20 o14 strd_ed]; Daniel@0: sel_var1_pos = [o10 o15 var_pop]; Daniel@0: frame3_pos = [f_fr(1) o1 f_fr(3) o3]; Daniel@0: scale_text_pos = [ok_pb(1) o4 title_txt]; Daniel@0: scale_pos = [o20 o5 1.3*var_pop(1) var_pop(2)]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame4_pos = f_fr+o25; Daniel@0: ok_pos = ok_pb+o25; Daniel@0: cancel_pos = cancel_pb+o25; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','recolorbar', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options, recolorbar', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% In subplot(s) Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','In subplot(s)', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Ticks Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',tics_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Ticks', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed3_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',tics_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed3_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(3),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_var2_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Labels (cell array) Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',labels_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Labels', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed2_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',labels_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed2_h,'units','normalized'); Daniel@0: Daniel@0: s = ['tmp=get(' mat2str(fig_h) ',''userdata'');' ... Daniel@0: 'vis_show_gui_tool(tmp(2),''select'')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% Select variable Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',sel_var1_pos, ... Daniel@0: 'String','Select variable', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Scale Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',scale_text_pos, ... Daniel@0: 'HorizontalAlignment','left', ... Daniel@0: 'String','Scale', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: s = {'denormalized' 'normalized'}; Daniel@0: p1_h = uicontrol( ... %% [popupmenu] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',scale_pos, ... Daniel@0: 'String',s, ... Daniel@0: 'Style','popupmenu'); Daniel@0: set(p1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame4_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''do_recolorbar'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: tmp_udata = [ed1_h ed2_h ed3_h p1_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',tmp_udata, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%% Daniel@0: % clear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%% Daniel@0: elseif strcmp(action,'clear') Daniel@0: old_fig_n = watchon; Daniel@0: W = 232; H = 277.463; Daniel@0: o25 = zeros(1,4); Daniel@0: o25(1) = (W-f_fr(3))/2; Daniel@0: f_fr = [7.9 8.38 (W-2*7.9) 36.9]; % final frame Daniel@0: cancel_pb = [(W-(ok_pb(1)+75.9)) 15.76 75.9 22.14]; Daniel@0: hint_txt = [W 18.45]; % hint text width and height Daniel@0: units = get(h,'units'); Daniel@0: set(h,'units','pixels'); Daniel@0: fp = get(h,'Position'); Daniel@0: fig_pos = [(fp(1)+fp(3)) ... Daniel@0: (fp(2)+fp(2)+fp(4)/2-H/2) ... Daniel@0: W ... Daniel@0: H]; Daniel@0: o1 = sum(f_fr([2 4]))+frames_dist; Daniel@0: o2 = o1+dist1; Daniel@0: o3 = (W-radio_rb(1))/2; Daniel@0: o4 = o2+radio_rb(2)+dist1; Daniel@0: o5 = o4+radio_rb(2)+dist1; Daniel@0: o6 = o5+radio_rb(2)+dist1; Daniel@0: o7 = o6+radio_rb(2)+dist1; Daniel@0: o8 = 5*radio_rb(2)+6*dist1; Daniel@0: o9 = o1+o8+frames_dist2; Daniel@0: o10 = max([title_txt(2),title_edit_h]); Daniel@0: o11 = o9+dist1+0.5*o10-title_txt(2)/2; Daniel@0: o12 = o9+dist1+0.5*o10-strd_ed(2)/2; Daniel@0: o20 = W-(ok_pb(1)+strd_ed(1)); Daniel@0: o13 = o10+2*dist1; Daniel@0: o24 = o9+o13+hint_dist1; Daniel@0: hint_text_pos = [1 o24 hint_txt]; Daniel@0: frame1_pos = [f_fr(1) o9 f_fr(3) o13]; Daniel@0: subplots_text_pos = [ok_pb(1) o11 title_txt]; Daniel@0: subplots_pos = [o20 o12 strd_ed]; Daniel@0: frame2_pos = [f_fr(1) o1 f_fr(3) o8]; Daniel@0: radiob1_pos = [o3 o7 selvar_pb]; Daniel@0: radiob2_pos = [o3 o6 selvar_pb]; Daniel@0: radiob3_pos = [o3 o5 selvar_pb]; Daniel@0: radiob4_pos = [o3 o4 selvar_pb]; Daniel@0: radiob5_pos = [o3 o2 selvar_pb]; Daniel@0: f_fr = [7.9 8.38 216.2 36.9]; % final frame Daniel@0: cancel_pb = [139 15.76 75.9 22.14]; Daniel@0: frame3_pos = f_fr;%+o25; Daniel@0: ok_pos = ok_pb;%+o25; Daniel@0: cancel_pos = cancel_pb;%+o25; Daniel@0: Daniel@0: fig_h = figure( ... Daniel@0: 'Units','pixels', ... Daniel@0: 'Position', fig_pos, ... Daniel@0: 'Color',fig_color, ... Daniel@0: 'NumberTitle','off', ... Daniel@0: 'Name','clear label', ... Daniel@0: 'MenuBar','none', ... Daniel@0: 'Visible','off'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% hint Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',fig_color, ... Daniel@0: 'HorizontalAlignment','center', ... Daniel@0: 'Position',hint_text_pos, ... Daniel@0: 'String','Options for clearing', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame1_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% From subplots Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',subplots_text_pos, ... Daniel@0: 'String','From subplots', ... Daniel@0: 'Style','text'),'units','normalized'); Daniel@0: Daniel@0: ed1_h = uicontrol( ... %% [edit] Daniel@0: 'Units','pixels', ... Daniel@0: 'BackgroundColor',bg_color2, ... Daniel@0: 'Position',subplots_pos, ... Daniel@0: 'FontSize',12, ... Daniel@0: 'Style','edit'); Daniel@0: set(ed1_h,'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame2_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: rb1_h = uicontrol( ... %% Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',radiob1_pos, ... Daniel@0: 'style','radiobutton', ... Daniel@0: 'String','All', ... Daniel@0: 'value',1); Daniel@0: Daniel@0: rb2_h = uicontrol( ... %% Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',radiob2_pos, ... Daniel@0: 'style','radiobutton', ... Daniel@0: 'String','Comet'); Daniel@0: Daniel@0: rb3_h = uicontrol( ... %% Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',radiob3_pos, ... Daniel@0: 'style','radiobutton', ... Daniel@0: 'String','Hit'); Daniel@0: Daniel@0: rb4_h = uicontrol( ... %% Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',radiob4_pos, ... Daniel@0: 'style','radiobutton', ... Daniel@0: 'String','Label'); Daniel@0: Daniel@0: rb5_h = uicontrol( ... %% Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',radiob5_pos, ... Daniel@0: 'style','radiobutton', ... Daniel@0: 'String','Trajectory'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% [frame] Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',frame3_pos, ... Daniel@0: 'Style','frame'),'units','normalized'); Daniel@0: Daniel@0: s = ['vis_show_gui_tool(' mat2str(h) ',''c_clear'',' mat2str(fig_h) ')']; Daniel@0: set( ... Daniel@0: uicontrol( ... %% OK Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',ok_pos, ... Daniel@0: 'String','OK', ... Daniel@0: 'Callback',s),'units','normalized'); Daniel@0: Daniel@0: set( ... Daniel@0: uicontrol( ... %% Cancel Daniel@0: 'Units','pixels', ... Daniel@0: 'Position',cancel_pos, ... Daniel@0: 'String','Cancel', ... Daniel@0: 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); Daniel@0: Daniel@0: watchoff(old_fig_n); Daniel@0: tmp_udata = [ed1_h rb1_h rb2_h rb3_h rb4_h rb5_h]; Daniel@0: set(fig_h,'units','normalized', ... Daniel@0: 'Visible','on', ... Daniel@0: 'UserData',tmp_udata, ... Daniel@0: 'handlevisibility','off'); Daniel@0: Daniel@0: %%%%%%%%% Daniel@0: % c_clear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%% Daniel@0: elseif strcmp(action,'c_clear') Daniel@0: thisfig = varargin{1}; Daniel@0: u = get(varargin{1},'UserData'); Daniel@0: s = get(u(1),'String'); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e), Daniel@0: if ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: else Daniel@0: e=1:length(handles); Daniel@0: end Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots!'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: else, Daniel@0: e = ''; Daniel@0: end Daniel@0: set(0,'currentfigure',child) Daniel@0: v = get(u(2),'value'); Daniel@0: if v, Daniel@0: if ~isempty(e), Daniel@0: som_show_clear('lab',e); Daniel@0: som_show_clear('hit',e); Daniel@0: som_show_clear('traj',e); Daniel@0: som_show_clear('comet',e); Daniel@0: else Daniel@0: som_show_clear('lab'); Daniel@0: som_show_clear('hit'); Daniel@0: som_show_clear('traj'); Daniel@0: som_show_clear('comet'); Daniel@0: end Daniel@0: end Daniel@0: v = get(u(3),'value'); Daniel@0: if v, Daniel@0: if ~isempty(e) Daniel@0: som_show_clear('comet',e); Daniel@0: else Daniel@0: som_show_clear('comet'); Daniel@0: end Daniel@0: end Daniel@0: v = get(u(4),'value'); Daniel@0: if v, Daniel@0: if ~isempty(e), Daniel@0: som_show_clear('hit',e); Daniel@0: else Daniel@0: som_show_clear('hit'); Daniel@0: end Daniel@0: end Daniel@0: v = get(u(5),'value'); Daniel@0: if v, Daniel@0: if ~isempty(e), Daniel@0: som_show_clear('lab',e); Daniel@0: else Daniel@0: som_show_clear('lab'); Daniel@0: end Daniel@0: end Daniel@0: v = get(u(6),'value'); Daniel@0: if v, Daniel@0: if ~isempty(e), Daniel@0: som_show_clear('traj',e); Daniel@0: else Daniel@0: som_show_clear('traj'); Daniel@0: end Daniel@0: end Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%%%%%%%%%%% Daniel@0: % do_recolorbar %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%%%%%% Daniel@0: elseif strcmp(action,'do_recolorbar') Daniel@0: args = {}; Daniel@0: ud = get(varargin{1},'UserData'); Daniel@0: s = get(ud(1),'String'); Daniel@0: e = 1:length(handles); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e) & ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: end Daniel@0: args = [args {e}]; Daniel@0: s = get(ud(3),'String'); Daniel@0: tmp = 'auto'; Daniel@0: if strcmp(s,'auto') | strcmp(s,'border'), Daniel@0: tmp = s; Daniel@0: elseif ~isempty(s) Daniel@0: tmp = evalin('base',s); Daniel@0: end Daniel@0: args = [args {tmp}]; Daniel@0: v = get(ud(4),'Value'); Daniel@0: s = get(ud(4),'String'); Daniel@0: args = [args {s{v}}]; Daniel@0: s = get(ud(2),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {evalin('base',s)}]; Daniel@0: end Daniel@0: thisfig = varargin{1}; Daniel@0: % set(0,'CurrentFigure',udata.vis_h); Daniel@0: set(0,'currentfigure',child) Daniel@0: som_recolorbar(args{:}); Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%%%% Daniel@0: % label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%% Daniel@0: elseif strcmp(action,'label') Daniel@0: args = {'label'}; Daniel@0: ud = get(varargin{1},'UserData'); Daniel@0: s = get(ud(2),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {evalin('base',s)}]; Daniel@0: else Daniel@0: args = [args {udata.sM}]; Daniel@0: end Daniel@0: s = get(ud(3),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {'TextSize' eval(s)}]; Daniel@0: end Daniel@0: v = get(ud(4),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(4),'UserData'); Daniel@0: args = [args {'TextColor' s{v}}]; Daniel@0: end Daniel@0: s = get(ud(1),'String'); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e), Daniel@0: if ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: else Daniel@0: e=1:length(handles); Daniel@0: end Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots!'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: args = [args {'SubPlot' e}]; Daniel@0: end Daniel@0: thisfig = varargin{1}; Daniel@0: % set(0,'CurrentFigure',udata.vis_h); Daniel@0: set(0,'currentfigure',child) Daniel@0: som_show_add(args{:}); Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%% Daniel@0: % hit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%% Daniel@0: elseif strcmp(action,'hit') Daniel@0: args = {'hit'}; Daniel@0: ud = get(varargin{1},'UserData'); Daniel@0: s = get(ud(2),'String'); Daniel@0: e = evalin('base',s); Daniel@0: [dummy k] = size(e); Daniel@0: args = [args {e}]; Daniel@0: v = get(ud(10),'Value'); Daniel@0: s = get(ud(10),'UserData'); Daniel@0: args = [args {'EdgeColor' s{v}}]; Daniel@0: % Daniel@0: s = get(ud(7),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {'MarkerSize' eval(s)}]; Daniel@0: end Daniel@0: if k == 1, Daniel@0: v = get(ud(6),'Value'); Daniel@0: if v<16, Daniel@0: s = get(ud(6),'String'); Daniel@0: args = [args {'Marker' s{v}}]; Daniel@0: else Daniel@0: % errordlg(); Daniel@0: return; Daniel@0: end Daniel@0: v = get(ud(9),'Value'); Daniel@0: if v<10, Daniel@0: s = get(ud(9),'UserData'); Daniel@0: args = [args {'MarkerColor' s{v}}]; Daniel@0: else Daniel@0: % errordlg(); Daniel@0: return; Daniel@0: end Daniel@0: % Daniel@0: v = get(ud(5),'Value'); Daniel@0: s = get(ud(5),'String'); Daniel@0: args = [args {'Text' s{v}}]; Daniel@0: if v>1, % 1='off' Daniel@0: v = get(ud(3),'Value'); Daniel@0: s = get(ud(3),'UserData'); Daniel@0: args = [args {'TextColor' s{v}}]; Daniel@0: % Daniel@0: s = get(ud(4),'String'); Daniel@0: args = [args {'TextSize' eval(s)}]; Daniel@0: end Daniel@0: else Daniel@0: v = get(ud(8),'Value'); Daniel@0: s = get(ud(8),'String'); Daniel@0: args = [args {'SizeFactor' s{v}}]; Daniel@0: % Daniel@0: v = get(ud(6),'Value'); Daniel@0: s = get(ud(6),'String'); Daniel@0: args = [args {'Marker' s{v}}]; Daniel@0: % Daniel@0: v = get(ud(9),'Value'); Daniel@0: s = get(ud(9),'UserData'); Daniel@0: args = [args {'MarkerColor' s{v}}]; Daniel@0: end Daniel@0: Daniel@0: s = get(ud(1),'String'); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e), Daniel@0: if ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: else Daniel@0: e=1:length(handles); Daniel@0: end Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots!'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: args = [args {'SubPlot' e}]; Daniel@0: end Daniel@0: thisfig = varargin{1}; Daniel@0: % set(0,'CurrentFigure',udata.vis_h); Daniel@0: set(0,'currentfigure',child) Daniel@0: som_show_add(args{:}); Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%%% Daniel@0: % traj %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%% Daniel@0: elseif strcmp(action,'traj') Daniel@0: args = {'traj'}; Daniel@0: ud = get(varargin{1},'UserData'); Daniel@0: s = get(ud(2),'String'); Daniel@0: args = [args {evalin('base',s)}]; Daniel@0: s = get(ud(4),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {'TrajWidth' eval(s)}]; Daniel@0: end Daniel@0: v = get(ud(5),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(5),'String'); Daniel@0: args = [args {'WidthFactor' s{v}}]; Daniel@0: end Daniel@0: v = get(ud(3),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(3),'UserData'); Daniel@0: args = [args {'TrajColor' s{v}}]; Daniel@0: end Daniel@0: v = get(ud(6),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(6),'String'); Daniel@0: args = [args {'Marker' s{v}}]; Daniel@0: end Daniel@0: s = get(ud(7),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {'MarkerSize' eval(s)}]; Daniel@0: end Daniel@0: v = get(ud(8),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(8),'String'); Daniel@0: args = [args {'SizeFactor' s{v}}]; Daniel@0: end Daniel@0: v = get(ud(9),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(9),'UserData'); Daniel@0: args = [args {'MarkerColor' s{v}}]; Daniel@0: end Daniel@0: v = get(ud(10),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(10),'UserData'); Daniel@0: args = [args {'EdgeColor' s{v}}]; Daniel@0: end Daniel@0: s = get(ud(1),'String'); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e), Daniel@0: if ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: else Daniel@0: e=1:length(handles); Daniel@0: end Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots!'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: args = [args {'SubPlot' e}]; Daniel@0: end Daniel@0: thisfig = varargin{1}; Daniel@0: % set(0,'CurrentFigure',udata.vis_h); Daniel@0: set(0,'currentfigure',child) Daniel@0: som_show_add(args{:}); Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%%%% Daniel@0: % comet %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%% Daniel@0: elseif strcmp(action,'comet') Daniel@0: args = {'comet'}; Daniel@0: ud = get(varargin{1},'UserData'); Daniel@0: s = get(ud(2),'String'); Daniel@0: args = [args {evalin('base',s)}]; Daniel@0: v = get(ud(3),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(3),'String'); Daniel@0: args = [args {'Marker' s{v}}]; Daniel@0: end Daniel@0: s = get(ud(4),'String'); Daniel@0: if ~isempty(s) Daniel@0: args = [args {'MarkerSize' eval(s)}]; Daniel@0: end Daniel@0: v = get(ud(5),'Value'); Daniel@0: s = get(ud(5),'UserData'); Daniel@0: if v==10, Daniel@0: args = [args {'MarkerColor' evalin('base',s{10})}]; Daniel@0: else Daniel@0: args = [args {'MarkerColor' s{v}}]; Daniel@0: end Daniel@0: v = get(ud(6),'Value'); Daniel@0: if v>1, Daniel@0: s = get(ud(6),'UserData'); Daniel@0: args = [args {'EdgeColor' s{v}}]; Daniel@0: end Daniel@0: s = get(ud(1),'String'); Daniel@0: if ~isempty(s) Daniel@0: if s(1)=='[' | (s(1)>='1' & s(1)<='9') Daniel@0: sprintf(s,'[%s]',s); Daniel@0: e = eval(s); else e = s; Daniel@0: end Daniel@0: if vis_valuetype(e,{'1xn','nx1','string'}), Daniel@0: if ischar(e), Daniel@0: if ~strcmp(e,'all'), Daniel@0: errordlg({'Only valid string value' ... Daniel@0: 'for subplot indices is ''all''.'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: else Daniel@0: e=1:length(handles); Daniel@0: end Daniel@0: elseif any(e<1) | any(e>length(handles)), Daniel@0: errordlg({'Subplot indices must be in', ... Daniel@0: 'range 1...number_of_subplots!'}, ... Daniel@0: 'Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: elseif ~isempty(e) Daniel@0: errordlg('Invalid subplot indices!','Error in SOM_VIS: tools'); Daniel@0: return; Daniel@0: end Daniel@0: args = [args {'SubPlot' e}]; Daniel@0: end Daniel@0: thisfig = varargin{1}; Daniel@0: % set(0,'CurrentFigure',udata.vis_h); Daniel@0: set(0,'currentfigure',child) Daniel@0: som_show_add(args{:}); Daniel@0: close(thisfig); Daniel@0: Daniel@0: %%%%%%%% Daniel@0: % select %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%% Daniel@0: elseif strcmp(action,'select') Daniel@0: %% NOTE: input h is not main_gui_handle Daniel@0: %% but edit menu handle Daniel@0: w = evalin('base','whos'); Daniel@0: for (i=1:length(w)) Daniel@0: size_frst{i} = mat2str(w(i).size(1)); Daniel@0: x(i,1) = 'x'; Daniel@0: size_scnd{i} = mat2str(w(i).size(2)); Daniel@0: end Daniel@0: names = strvcat(w.name); Daniel@0: [dummy vert] = size(names); Daniel@0: for (i=1:length(w)) Daniel@0: for (j=1:8) Daniel@0: sp(i,j) = ' '; Daniel@0: end Daniel@0: end Daniel@0: size_M = strjust(strvcat(size_frst{:}),'right'); Daniel@0: size_N = strjust(strvcat(size_scnd{:}),'left'); Daniel@0: classes = strvcat(w.class); Daniel@0: s = [cellstr([names sp size_M x size_N sp classes])]'; Daniel@0: Daniel@0: [sel,ok] = listdlg('ListString',s,... Daniel@0: 'Name','Variable selection',... Daniel@0: 'PromptString','Select variable', ... Daniel@0: 'SelectionMode','single'); Daniel@0: if ok & ~isempty(sel), Daniel@0: w = {w.name}; Daniel@0: if ishandle(h), Daniel@0: set(h,'String',w{sel}); Daniel@0: elseif nargout==1, Daniel@0: r = w{sel}; Daniel@0: end Daniel@0: elseif nargout==1, Daniel@0: r = ''; Daniel@0: end Daniel@0: Daniel@0: %%%%%%%%%%%%%% Daniel@0: % popup_select %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Daniel@0: %%%%%%%%%%%%%% Daniel@0: elseif strcmp(action,'popup_select') Daniel@0: %% NOTE: input h is not main_gui_handle Daniel@0: %% but h(1) is popupmenu handle and h(2:end) are indeces Daniel@0: v = get(h(1),'Value'); Daniel@0: if any(v==h(2:end)), Daniel@0: w = evalin('base','whos'); Daniel@0: for (i=1:length(w)) Daniel@0: size_frst{i} = mat2str(w(i).size(1)); Daniel@0: x(i,1) = 'x'; Daniel@0: size_scnd{i} = mat2str(w(i).size(2)); Daniel@0: end Daniel@0: names = strvcat(w.name); Daniel@0: [dummy vert] = size(names); Daniel@0: for (i=1:length(w)) Daniel@0: for (j=1:8) Daniel@0: sp(i,j) = ' '; Daniel@0: end Daniel@0: end Daniel@0: size_M = strjust(strvcat(size_frst{:}),'right'); Daniel@0: size_N = strjust(strvcat(size_scnd{:}),'left'); Daniel@0: classes = strvcat(w.class); Daniel@0: s = [cellstr([names sp size_M x size_N sp classes])]'; Daniel@0: [sel,ok] = listdlg('ListString',s,... Daniel@0: 'Name','Variable selection',... Daniel@0: 'PromptString','Select variable', ... Daniel@0: 'SelectionMode','single'); Daniel@0: if ok & ~isempty(sel), Daniel@0: w = {w.name}; Daniel@0: i = find(v==h(2:end)); Daniel@0: s = get(h(1),'String'); Daniel@0: s{h(i+1)} = w{sel}; Daniel@0: set(h(1),'String',s); Daniel@0: if nargout==1, Daniel@0: r = w{sel}; Daniel@0: end Daniel@0: elseif nargout==1, Daniel@0: r = ''; Daniel@0: end Daniel@0: end Daniel@0: Daniel@0: end Daniel@0: