⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grabit.m

📁 用于获得图片上曲线的数值
💻 M
📖 第 1 页 / 共 5 页
字号:
  'tag'                             , 'LoadImageBtn');uicontrol(...  'style'                           , 'edit', ...  'backgroundcolor'                 , bgcolor2, ...  'string'                          , '', ...  'position'                        , [220, fH-40, panelW-215, 25], ...  'horizontalalignment'             , 'left', ...  'enable'                          , 'inactive', ...  'tag'                             , 'ImageFileLoc');uicontrol(...  'style'                           , 'frame', ...  'position'                        , [15, fH-75, 3*(panelW-20)/4-5, 30], ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'togglebutton', ...  'string'                          , 'Calibrate', ...  'buttondownfcn'                   , @calibrateImageFcn, ...  'position'                        , [20, fH-72, panelW/4-25, 25], ...  'enable'                          , 'off', ...  'tag'                             , 'CalibrateImageBtn');calibFrameX = panelW/4-5;calibFrameW = panelW/2-10;uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5, fH-70, calibFrameW/8, 15], ...  'string'                          , 'Xo:', ...  'fontweight'                      , 'bold', ...  'horizontalalignment'             , 'right', ...  'tooltipstring'                   , sprintf('Calibration:\nX-Axis Origin'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+calibFrameW/8, fH-70, calibFrameW/8, 15], ...  'string'                          , ' NaN', ...  'horizontalalignment'             , 'left', ...  'tag'                             , 'hXoValue', ...  'tooltipstring'                   , sprintf('Calibration:\nX-Axis Origin'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+calibFrameW/4, fH-70, calibFrameW/8, 15], ...  'string'                          , 'Xm:', ...  'fontweight'                      , 'bold', ...  'horizontalalignment'             , 'right', ...  'tooltipstring'                   , sprintf('Calibration:\nX-Axis Max'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+3*calibFrameW/8, fH-70, calibFrameW/8, 15], ...  'string'                          , ' NaN', ...  'horizontalalignment'             , 'left', ...  'tag'                             , 'hXmValue', ...  'tooltipstring'                   , sprintf('Calibration:\nX-Axis Max'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+calibFrameW/2, fH-70, calibFrameW/8, 15], ...  'string'                          , 'Yo:', ...  'fontweight'                      , 'bold', ...  'horizontalalignment'             , 'right', ...  'tooltipstring'                   , sprintf('Calibration:\nY-Axis Origin'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+5*calibFrameW/8, fH-70, calibFrameW/8, 15], ...  'string'                          , ' NaN', ...  'horizontalalignment'             , 'left', ...  'tag'                             , 'hYoValue', ...  'tooltipstring'                   , sprintf('Calibration:\nY-Axis Origin'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+3*calibFrameW/4, fH-70, calibFrameW/8, 15], ...  'string'                          , 'Ym:', ...  'fontweight'                      , 'bold', ...  'horizontalalignment'             , 'right', ...  'tooltipstring'                   , sprintf('Calibration:\nY-Axis Max'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'text', ...  'position'                        , [calibFrameX+5+7*calibFrameW/8, fH-70, calibFrameW/8, 15], ...  'string'                          , ' NaN', ...  'horizontalalignment'             , 'left', ...  'tag'                             , 'hYmValue', ...  'tooltipstring'                   , sprintf('Calibration:\nY-Axis Max'), ...  'backgroundcolor'                 , bgcolor2);uicontrol(...  'style'                           , 'togglebutton', ...  'string'                          , 'Grab Points', ...  'buttondownfcn'                   , @grabPointsFcn, ...  'position'                        , [3*(panelW)/4, fH-72, panelW/4+5, 25], ...  'enable'                          , 'off', ...  'tag'                             , 'GrabPointsBtn');uicontrol(...  'style'                           , 'togglebutton', ...  'cdata'                           , zI1, ...  'buttondownfcn'                   , @zoomBtnFcn, ...  'position'                        , [15, fH-105, 25, 25], ...  'enable'                          , 'inactive', ...  'tag'                             , 'ZoomStateBtn');uicontrol(...  'style'                           , 'pushbutton', ...  'string'                          , 'Reset View ', ...  'callback'                        , @resetViewFcn, ...  'position'                        , [45, fH-105, 100, 25], ...  'tag'                             , 'ResetViewBtn');uicontrol(...  'style'                           , 'text', ...  'position'                        , [150, fH-108, panelW-145, 31], ...  'horizontalalignment'             , 'center', ...  'foregroundcolor'                 , [0 0 .5], ...  'backgroundcolor'                 , bgcolor2, ...  'fontsize'                        , 10, ...  'string'                          , {'Click and drag to pan. Double-click to center. Right-click and drag to zoom.', ...    'Keyboard Shortcuts: <a> - zoom in, <z> - zoom out, <space> - reset view'});rPanelX = 0.82 * fW;rPanelW = fW - rPanelX - 10;uicontrol(...  'style'                           , 'listbox', ...  'callback'                        , @selectVariableFcn, ...  'position'                        , [rPanelX+10, 100, rPanelW-20, 0.6*fH], ...  'backgroundcolor'                 , bgcolor2, ...  'tooltipstring'                   , sprintf('Double-click to edit\nvariable in Array Editor'), ...  'tag'                             , 'VariableList');uicontrol(...  'style'                           , 'text', ...  'string'                          , 'Data in Memory', ...  'position'                        , [rPanelX+10, 0.6*fH+100, rPanelW-20, 20], ...  'backgroundcolor'                 , bgcolor1, ...  'fontweight'                      , 'bold');uicontrol(...  'style'                           , 'pushbutton', ...  'string'                          , 'Save to file as...', ...  'position'                        , [rPanelX+10, 70, rPanelW-20, 25], ...  'callback'                        , @variableManipulationFcn, ...  'tooltipstring'                   , sprintf('Save variable as a MAT file or\nDouble-precision, tab-delimited TXT file'), ...  'tag'                             , 'SaveAs');uicontrol(...  'style'                           , 'pushbutton', ...  'string'                          , 'Rename...', ...  'position'                        , [rPanelX+10, 45, rPanelW-20, 25], ...  'callback'                        , @variableManipulationFcn, ...  'tooltipstring'                   , 'Rename variable in workspace', ...  'tag'                             , 'Rename');uicontrol(...  'style'                           , 'pushbutton', ...  'string'                          , 'Delete...', ...  'position'                        , [rPanelX+10, 20, rPanelW-20, 25], ...  'callback'                        , @variableManipulationFcn, ...  'tooltipstring'                   , 'Delete variable from workspace', ...  'tag'                             , 'Delete');axes(...  'position'                        , [10, 10, 0.8*fW, fH-200], ...  'visible'                         , 'on', ...  'handlevisibility'                , 'on', ...  'box'                             , 'on', ...  'drawmode'                        , 'fast', ...  'xtick'                           , [], ...  'ytick'                           , [], ...  'interruptible'                   , 'off', ...  'buttondownfcn'                   , @winBtnDownFcn, ...  'tag'                             , 'ImageAxis');imAxRatio = (fH - 200) / (0.8 * fW);title('', 'fontunits', 'pixels', 'fontsize', 24, 'color', 'red');axes(...  'position'                        , [rPanelX+20, 0.6*fH+150, rPanelW-30, 0.4*fH-190], ...  'box'                             , 'on', ...  'tag'                             , 'PreviewAxis');uicontrol(...  'style'                           , 'text', ...  'string'                          , 'Preview Box', ...  'fontweight'                      , 'bold', ...  'position'                        , [rPanelX+20, fH-40, rPanelW-30, 25], ...  'backgroundcolor'                 , bgcolor1);uicontrol(...  'style'                           , 'edit', ...  'backgroundcolor'                 , bgcolor4, ...  'string'                          , 'Enter Value', ...  'position'                        , [0 0 100 25], ...  'horizontalalignment'             , 'left', ...  'visible'                         , 'off', ...  'callback'                        , @coordinateEditFcn, ...  'tag'                             , 'CoordinateEdit');set(findobj(im, 'type', 'uicontrol'), 'units', 'normalized');set(findobj(im, 'type', 'axes'), 'units', 'normalized');% create handles structurehandles                           = guihandles(im);handles.zoomPointer               = zoomPointer;handles.zoomPointerHotSpot        = [2 2];handles.zoomInOutPointer          = zoomInOutPointer;handles.zoomInOutPointerHotSpot   = [9 9];handles.closedHandPointer         = closedHandPointer;handles.closedHandPointerHotSpot  = [9 9];handles.xoPointer                 = xoPointer;handles.xoPointerHotSpot          = [2 2];handles.xmPointer                 = xmPointer;handles.xmPointerHotSpot          = [2 2];handles.yoPointer                 = yoPointer;handles.yoPointerHotSpot          = [2 2];handles.ymPointer                 = ymPointer;handles.ymPointerHotSpot          = [2 2];handles.zoomIconUp                = zI1;handles.zoomIconDown              = zI2;handles.curPointer                = 'arrow';handles.curPointerData.CData      = zoomPointer;handles.curPointerData.HotSpot    = [1 1];handles.state                     = 'normal';handles.bgcolor1                  = bgcolor1;handles.bgcolor2                  = bgcolor2;handles.bgcolor3                  = bgcolor3;handles.bgcolor4                  = bgcolor4;handles.imAxRatio                 = imAxRatio;handles.I                         = [];handles.map                       = [];handles.savedVars                 = struct;handles.isPanning                 = false;handles.curTitle                  = '';handles.CurrentPointAxes          = [];handles.CurrentPointFig           = [];handles.timer                     = timer(...                                          'Name', 'BtnUpTimer', ...                                          'StartDelay', 0.2, ...                                          'TimerFcn', {@btnUpTimerFcn, im});guidata(im, handles);set(im, 'handlevisibility', 'callback');if nargin == 1 && ischar(fname)  switch lower(fname)    case '-sample'      fname = createSampleImageFcn;      if ~isempty(fname)        loadImageFcn(handles.LoadImageBtn, [], fname);        try          pause(0.5);          delete(fname);        catch          errordlg(lasterr);        end      end          otherwise      filename = which(fname);      if ~isempty(filename)        loadImageFcn(handles.LoadImageBtn, [], filename);      else        errordlg(sprintf('%s\nnot found.', fname));        return;      end  endendset(im, 'visible', 'on');%--------------------------------------------------------------------------%--------------------------------------------------------------------------% variableManipulationFcn%--------------------------------------------------------------------------%--------------------------------------------------------------------------function variableManipulationFcn(varargin)% This callback is called when one of the three buttons under the variable% listbox is pressed.obj = varargin{1};handles = guidata(obj);vars = fieldnames(handles.savedVars);if isempty(vars)  return;endlistboxVal = get(handles.VariableList, 'value');varName = vars{listboxVal};switch get(obj, 'Tag')    case 'SaveAs' % save the variable as a .mat file    [fname, pname] = uiputfile(...      {'*.mat', 'MAT files (*.mat)'; ...      '*.txt', 'TXT files (*.txt)'}, ...      sprintf('Save ''%s'' as:', varName), ...      varName);    if ~isequal(fname, 0) && ~isequal(pname, 0)      saveDatFcn(pname, fname, handles.savedVars.(varName))    end            case 'Rename'  % rename the variable in the base workspace    answer = inputdlg({sprintf('Rename ''%s'' as:', varName)}, ...      'Rename...', 1, {varName});    if ~isempty(answer) && ~strcmp(varName, answer{1})      if ~(evalin('base', sprintf('exist(''%s'', ''var'')', answer{1}))) && ...          isempty(strmatch(answer{1}, vars, 'exact'))        newVarNames = vars;        newVarNames{listboxVal} = answer{1};        for id = 1:length(vars)          tmp.(newVarNames{id}) = handles.savedVars.(vars{id});        end        handles.savedVars = tmp;        showAllVarsFcn(handles);        set(handles.VariableList, 'value', listboxVal);        assignin('base', answer{1}, handles.savedVars.(answer{1}));        evalin('base', sprintf('clear %s;', varName));      else        errordlg('That name is already in use.');        return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -