📄 vis_show_gui_comp.m
字号:
function vis_show_gui_comp(h, indx, action,varargin)%VIS_SHOW_GUI_COMP is a subfunction of SOM_SHOW_GUI.%% vis_show_gui_comp(handle, indx, action, varargin)%% Input arguments:% handle (struct) % indx (scalar)% action (string)% varargin (varies)% % See also SOM_SHOW_GUI.% Copyright (c) 2000 by Roman Feldman and Juha Vesanto% Contributed to SOM Toolbox on August 22nd, 2000% http://www.cis.hut.fi/projects/somtoolbox/ % Version 2.0beta roman 160800 juuso 220800%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MAIN %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%udata = get(h,'UserData');plot_array = udata.plot_array;l = length(plot_array); %%%%%%% init %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%if (strcmp(action,'init')) %--- color vars --- fig_color = [0.8 0.8 0.8]; bg_color1 = [0.701960784313725 0.701960784313725 0.701960784313725]; bg_color2 = [0.9 0.9 0.9]; %--- object position vars (in pixels) --- % calculations based on case 'comp' %% hint text hint_dist1 = 98.17-(61.27+36.9); % hint text lower edge and next lower frame upper edge hint_dist2 = 123-(98.17+18.45); % figure upper edge and hint text upper edge %% general dist1 = 67.42-61.27; % general distance between frame edge and object in frame %% frame + ok / cancel frames_dist = 61.27-(8.38+36.9); frames_dist2 = 8.38; f_fr = [7.9 8.38 216.2 36.9]; % final frame ok_pb = [17.1 15.76 75.9 22.14]; cancel_pb = [139 15.76 75.9 22.14]; %% objects hint_txt = [230 18.45]; % hint text width and height interp_cb = [98.9 24.6]; title_txt = [35 hint_txt(2)]; title_edit_h = 23.083; var_pop = interp_cb; list_lt = [130 130]; calc_txt = [list_lt(1) hint_txt(2)]; useall_pb = [50 interp_cb(2)]; if (length(indx) > 1) errordlg({'Same options for multiple subplots', ... 'not yet available'},'Error in SOM_VIS: options'); return; elseif (isempty(plot_array(1).args)) errordlg({'Try to select subplot first'}, ... 'Error in SOM_VIS: options'); return; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 'comp' % elseif (strncmp('comp',plot_array(indx).args{1},4)) old_fig_n = watchon; W = 230; H = 123; units = get(h,'units'); set(h,'units','pixels'); fp = get(h,'Position'); fig_pos = [(fp(1)+fp(3)) ... (fp(2)+fp(2)+fp(4)/2-H/2) ... W ... H]; o1 = sum(f_fr([2 4]))+frames_dist; o2 = o1+dist1; o3 = 2*dist1+interp_cb(2); o4 = o1+o3+hint_dist1; hint_text_pos = [1 o4 hint_txt]; frame1_pos = [f_fr(1) o1 f_fr(3) o3]; interp_pos = [ok_pb(1) o2 interp_cb]; frame2_pos = f_fr; ok_pos = ok_pb; cancel_pos = cancel_pb; fig_h = figure( ... 'Units','pixels', ... 'Position', fig_pos, ... 'Color',fig_color, ... 'NumberTitle','off', ... 'Name','component', ... 'MenuBar','none', ... 'Visible','off'); set( ... uicontrol( ... %% hint 'Units','pixels', ... 'BackgroundColor',fig_color, ... 'HorizontalAlignment','center', ... 'Position',hint_text_pos, ... 'String','Options for component plane', ... 'Style','text'),'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame1_pos, ... 'Style','frame'),'units','normalized'); pr = udata.property{indx}; chkb_h = uicontrol( ... %% interpolated 'Units','pixels', ... 'HorizontalAlignment','center', ... 'Position',interp_pos, ... 'Style','checkbox', ... 'String','interpolated', ... 'Value',pr{1}); set(chkb_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame2_pos, ... 'Style','frame'),'units','normalized'); s = ['vis_show_gui_comp(', ... mat2str(h), ',', mat2str(indx), ... ',''comp'',' mat2str(fig_h) ')']; set( ... uicontrol( ... %% OK 'Units','pixels', ... 'Position',ok_pos, ... 'String','OK', ... 'Callback',s),'units','normalized'); set( ... uicontrol( ... %% Cancel 'Units','pixels', ... 'Position',cancel_pos, ... 'String','Cancel', ... 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); watchoff(old_fig_n); tmp_udata = [chkb_h]; set(fig_h,'units','normalized', ... 'Visible','on', ... 'UserData',tmp_udata, ... 'handlevisibility','off'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 'umat' % elseif (strncmp('umat',plot_array(indx).args{1},4)) old_fig_n = watchon; W = 230; H = 335.893; units = get(h,'units'); set(h,'units','pixels'); fp = get(h,'Position'); fig_pos = [(fp(1)+fp(3)) ... (fp(2)+fp(2)+fp(4)/2-H/2) ... W ... H]; o1 = sum(f_fr([2 4]))+frames_dist; o2 = o1+dist1; o3 = 2*dist1+list_lt(2)+calc_txt(2); o4 = o2+list_lt(2); o5 = sum(cancel_pb([1 3]))-useall_pb(1); o6 = o2+o3/2-useall_pb(2)/2; o7 = o1+o3+frames_dist2; o8 = 2*dist1+interp_cb(2); o9 = o7+dist1; o10 = o7+o8+frames_dist2;; o11 = 2*dist1+max(title_edit_h,title_txt(2)); o12 = W-(title_txt(1)+2*ok_pb(1)); o13 = o10+dist1+(title_edit_h-title_txt(2))/2; o14 = o10+dist1; if title_txt(2)>title_edit_h, o13 = o10+dist1; o14 = o13+(title_edit_h-title_txt(2))/2; end o15 = ok_pb(1)+title_txt(1); o16 = o10+o11+hint_dist1; hint_text_pos = [1 o16 hint_txt]; frame1_pos = [f_fr(1) o10 f_fr(3) o11]; title_text_pos = [ok_pb(1) o13 title_txt]; title_pos = [o15 o14 o12 title_edit_h]; frame2_pos = [f_fr(1) o7 f_fr(3) o8]; interp_pos = [ok_pb(1) o9 interp_cb]; frame3_pos = [f_fr(1) o1 f_fr(3) o3]; list_text_pos = [ok_pb(1) o4 calc_txt]; list_pos = [ok_pb(1) o2 list_lt]; use_all_pos = [o5 o6 useall_pb]; frame4_pos = f_fr; ok_pos = ok_pb; cancel_pos = cancel_pb; fig_h = figure( ... 'Units','pixels', ... 'Position', fig_pos, ... 'Color',fig_color, ... 'NumberTitle','off', ... 'Name','U-matrix', ... 'MenuBar','none', ... 'Visible','off'); set( ... uicontrol( ... %% hint 'Units','pixels', ... 'BackgroundColor',fig_color, ... 'HorizontalAlignment','center', ... 'Position',hint_text_pos, ... 'String','Options for U-matrix', ... 'Style','text'),'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame1_pos, ... 'Style','frame'),'units','normalized'); set( ... uicontrol( ... %% title 'Units','pixels', ... 'Position',title_text_pos, ... 'BackgroundColor',bg_color1, ... 'HorizontalAlignment','left', ... 'Style','text', ... 'String','Title'),'units','normalized'); pr = udata.property{indx}; ed_h = uicontrol( ... %% [edit] 'Units','pixels', ... 'Position',title_pos, ... 'FontSize',12, ... 'Style','edit', ... 'String',pr{2}, ... 'BackgroundColor',bg_color2); set(ed_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame2_pos, ... 'Style','frame'),'units','normalized'); chkb_h = uicontrol( ... %% interpolated 'Units','pixels', ... 'Position',interp_pos, ... 'Style','checkbox', ... 'String','interpolated', ... 'Value',pr{1}); set(chkb_h,'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame3_pos, ... 'Style','frame'),'units','normalized'); set( ... uicontrol( ... %% calculated from 'Units','pixels', ... 'BackgroundColor',bg_color1, ... 'HorizontalAlignment','left', ... 'Position',list_text_pos, ... 'String','calculated from', ... 'Style','text'),'units','normalized'); list1_h = uicontrol( ... %% [listbox] 'Units','pixels', ... 'BackgroundColor',bg_color2, ... 'Position',list_pos, ... 'String',udata.sM.comp_names, ... 'Style','listbox', ... 'Max',2, ... 'Value',pr{3}); set(list1_h,'units','normalized'); s = ['tmp=get(' mat2str(fig_h) ',''userdata'');set(tmp(3),''value'',' ... mat2str(1:length(udata.sM.comp_names)) ');']; set( ... uicontrol( ... %% Use all 'Units','pixels', ... 'Position',use_all_pos, ... 'String','Use all', ... 'Callback',s),'units','normalized'); set( ... uicontrol( ... %% [frame] 'Units','pixels', ... 'Position',frame4_pos, ... 'Style','frame'),'units','normalized'); s = ['vis_show_gui_comp(' ... mat2str(h) ',' mat2str(indx) ... ',''umat'',' mat2str(fig_h) ')']; set( ... uicontrol( ... %% OK 'Units','pixels', ... 'Position',ok_pos, ... 'String','OK', ... 'Callback',s),'units','normalized'); set( ... uicontrol( ... %% Cancel 'Units','pixels', ... 'Position',cancel_pos, ... 'String','Cancel', ... 'Callback',['close(' mat2str(fig_h) ')']),'units','normalized'); watchoff(old_fig_n); tmp_udata = [chkb_h ed_h list1_h]; set(fig_h,'units','normalized', ... 'Visible','on', ... 'UserData', tmp_udata, ... 'handlevisibility','off'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 'color' % elseif (strncmp('color',plot_array(indx).args{1},5)) old_fig_n = watchon; W = 230; H = 212.043; units = get(h,'units'); set(h,'units','pixels'); fp = get(h,'Position'); fig_pos = [(fp(1)+fp(3)) ... (fp(2)+fp(2)+fp(4)/2-H/2) ... W ... H]; o1 = sum(f_fr([2 4]))+frames_dist; o2 = o1+dist1; o3 = 2*dist1+var_pop(2); o4 = o1+o3+frames_dist2; o5 = o4+dist1; o6 = 2*dist1+interp_cb(2); o7 = o4+o6+frames_dist2; o8 = 2*dist1+max(title_edit_h,title_txt(2)); o9 = W-(title_txt(1)+2*ok_pb(1)); o10 = o7+dist1+(title_edit_h-title_txt(2))/2; o11 = o7+dist1; if title_txt(2)>title_edit_h,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -