www.gusucode.com > EasyKrig_V3.0工具箱matlab源码程序 > EasyKrig_V3.0/dataprep/check_unitsfig.m
function action=check_unitsfig(opt) % check consistency of the units of coordinates to determine the appropriate normalization factors % opt =1 : decide whether to enter conversion factors automatically % =2 : enter conversion factors regradless of the units %% %% Kriging Software Package version 3.0, May 1, 2004 %% Copyright (c) 1999, 2001, 2004, property of Dezhang Chu and Woods Hole Oceanographic %% Institution. All Rights Reserved. global data para hdl color if isfield(para.dataprep,'checkunit_action') & opt == 1 action=1; return end indx_x=get(hdl.dataprep.x_unit,'value'); indx_y=get(hdl.dataprep.y_unit,'value'); indx_z=get(hdl.dataprep.z_unit,'value'); if indx_x ~= indx_y elseif indx_x ~= indx_z end if opt == 2 | ((indx_x >= 5 | indx_y > 5 | indx_z > 5) & (indx_x ~= indx_y) ) hdl.unit_conv.h0=figure('units','normalized','position',[0.3 0.3 0.3 0.3]); h1 = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'BackgroundColor',color.grey, ... 'FontWeight','bold', ... 'HorizontalAlignment','center', ... 'Position',[0.4 0.8 0.50 0.1], ... 'String','Conversion Factor', ... 'Style','text'); h1 = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'BackgroundColor',color.grey, ... 'FontWeight','bold', ... 'HorizontalAlignment','center', ... 'Position',[0.1 0.6 0.30 0.1], ... 'String','Y to X', ... 'Style','text'); % y to x convertion hdl.unit_conv.ytox = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'FontWeight','bold', ... 'HorizontalAlignment','center', ... 'Position',[0.55 0.6 0.25 0.1], ... 'String','1', ... 'Style','edit'); % z to x convertion h1 = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'BackgroundColor',color.grey, ... 'FontWeight','bold', ... 'HorizontalAlignment','center', ... 'Position',[0.1 0.4 0.30 0.1], ... 'String','Z to X', ... 'Style','text'); hdl.unit_conv.ztox = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'FontWeight','bold', ... 'HorizontalAlignment','center', ... 'Position',[0.55 0.4 0.25 0.1], ... 'String','1', ... 'Style','edit'); h1 = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'Callback','check_unit_action;', ... 'FontSize',10, ... 'FontWeight','bold', ... 'Position',[0.50 0.15 0.15 0.08], ... 'String','Ok', ... 'Tag','Action'); h1 = uicontrol('Parent',hdl.unit_conv.h0, ... 'Units','normalized', ... 'Callback','close', ... 'FontSize',10, ... 'FontWeight','bold', ... 'Position',[0.75 0.15 0.15 0.08], ... 'String','Quit', ... 'Tag','Quit'); action =1; else action =0; end para.dataprep.checkunit_action=action;