※鱼鱼╰☆ 发表于 2018-9-14 08:56:19

Matlab程序:手画光滑曲线图形界面

function fig = draw()
% 手画光滑曲线图形界面
% 先用Range确定大致范围;然后用ginput用鼠标单击大致数据点;最后用Draw it画图。
% 本程序采用样条拟合

% By L. J. Hu, 2000
% This is the machine-generated representation of a Handle Graphics object
% and its children.Note that handle values may change when these objects
% are re-created. This may cause problems with any callbacks written to
% depend on the value of the handle at the time the object was saved.
%
% To reopen this object, just type the name of the M-file at the MATLAB
% prompt. The M-file and its associated MAT-file must be on your path.

load draw

h0 = figure('Color',, ...
        'Colormap',mat0, ...
        'Name','Smooth Draw', ...
        'NumberTitle','off', ...
        'PointerShapeCData',mat1, ...
        'Position',, ...
        'Resize','off', ...
        'Tag','drawfig', ...
        'UserData',mat2);
h1 = axes('Parent',h0, ...
        'Units','pixels', ...
        'Box','on', ...
        'CameraUpVector',, ...
        'CameraUpVectorMode','manual', ...
        'Color',, ...
        'ColorOrder',mat3, ...
        'HandleVisibility','callback', ...
        'Position',, ...
        'Tag','Axes1', ...
        'XColor',, ...
        'XGrid','on', ...
        'XLimMode','manual', ...
        'YColor',, ...
        'YGrid','on', ...
        'YLimMode','manual', ...
        'ZColor',, ...
        'ZGrid','on');
h2 = text('Parent',h1, ...
        'Color',, ...
        'HandleVisibility','off', ...
        'HorizontalAlignment','center', ...
        'Position',, ...
        'Tag','Axes1Text4', ...
        'VerticalAlignment','cap');
set(get(h2,'Parent'),'XLabel',h2);
h2 = text('Parent',h1, ...
        'Color',, ...
        'HandleVisibility','off', ...
        'HorizontalAlignment','center', ...
        'Position',[-0.08959537572254335 0.4930875576036867 9.160254037844386], ...
        'Rotation',90, ...
        'Tag','Axes1Text3', ...
        'VerticalAlignment','baseline');
set(get(h2,'Parent'),'YLabel',h2);
h2 = text('Parent',h1, ...
        'Color',, ...
        'HandleVisibility','off', ...
        'HorizontalAlignment','right', ...
        'Position',[-0.1502890173410405 1.101382488479263 9.160254037844386], ...
        'Tag','Axes1Text2', ...
        'Visible','off');
set(get(h2,'Parent'),'ZLabel',h2);
h2 = text('Parent',h1, ...
        'Color',, ...
        'HandleVisibility','off', ...
        'HorizontalAlignment','center', ...
        'Position',, ...
        'Tag','Axes1Text1', ...
        'VerticalAlignment','bottom');
set(get(h2,'Parent'),'Title',h2);
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'BackgroundColor',, ...
        'ListboxTop',0, ...
        'Position',, ...
        'Style','frame', ...
        'Tag','Frame1');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','clear;=ginput;', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Ginput', ...
        'Tag','Pushbutton1');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','pp=csaps(x,y,0.9999);fnplt(pp,''b'',2);', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Draw It', ...
        'Tag','Pushbutton2');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','gline', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Line', ...
        'Tag','Pushbutton3');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback',mat4, ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Range', ...
        'Tag','Pushbutton4');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','cla;axis();hold off', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Erase', ...
        'Tag','Pushbutton5');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','grid', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Grid', ...
        'Tag','Pushbutton6');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'ListboxTop',0, ...
        'Position',, ...
        'Style','frame', ...
        'Tag','Frame2');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'BackgroundColor',, ...
        'Callback','eval(get(gcbo,''string''))', ...
        'ListboxTop',0, ...
        'Position',, ...
        'Style','edit', ...
        'Tag','EditText1');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback',mat5, ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Labels', ...
        'Tag','Pushbutton7');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'BackgroundColor',, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Command Window', ...
        'Style','text', ...
        'Tag','StaticText1');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'BackgroundColor',, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Control Panel', ...
        'Style','text', ...
        'Tag','StaticText2');
h1 = uicontrol('Parent',h0, ...
        'Units','points', ...
        'Callback','hold', ...
        'FontSize',14, ...
        'ListboxTop',0, ...
        'Position',, ...
        'String','Hold', ...
        'Tag','Pushbutton8');
if nargout > 0, fig = h0; end


页: [1]
查看完整版本: Matlab程序:手画光滑曲线图形界面