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

📄 untitled1.m

📁 人机交互小功能
💻 M
字号:
function varargout = untitled1(varargin)
% UNTITLED1 M-file for untitled1.fig
%      UNTITLED1, by itself, creates a new UNTITLED1 or raises the existing
%      singleton*.
%
%      H = UNTITLED1 returns the handle to a new UNTITLED1 or the handle to
%      the existing singleton*.
%
%      UNTITLED1('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in UNTITLED1.M with the given input arguments.
%
%      UNTITLED1('Property','Value',...) creates a new UNTITLED1 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before untitled1_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to untitled1_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help untitled1

% Last Modified by GUIDE v2.5 11-Apr-2009 12:19:10

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @untitled1_OpeningFcn, ...
                   'gui_OutputFcn',  @untitled1_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before untitled1 is made visible.
function untitled1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to untitled1 (see VARARGIN)

% Choose default command line output for untitled1
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes untitled1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = untitled1_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --------------------------------------------------------------------
function m_magic_Callback(hObject, eventdata, handles)
% hObject    handle to m_magic (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global mData
mData=magic(6)
hh=findobj(gcf,'Tag','text1');
set(hh,'String',int2str(mData));



% --------------------------------------------------------------------
function m_rand_Callback(hObject, eventdata, handles)
% hObject    handle to m_rand (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global m_Data
m_Data=floor(rand(6,7)*100);
hh=findobj(gcf,'Tag','text2');
set(hh,'String',int2str(m_Data));


% --------------------------------------------------------------------
function m_fuzhi_Callback(hObject, eventdata, handles)
% hObject    handle to m_fuzhi (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global m_Data
k=(mod(m_Data,2)==1);
m_Data(k)=200;
hh=findobj(gcf,'Tag','text2');
set(hh,'String',int2str(m_Data));


% --------------------------------------------------------------------
function m_panduan_Callback(hObject, eventdata, handles)
% hObject    handle to m_panduan (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%global m_Data
%l=(mod(m_Data,2)==0)||(mod(m_Data,3)==0);
%j=(m_Data~=200);
%h=(j&&l);
%m_Data(h)=0;
%hh=findobj(gcf,'Tag','text2');
%set(hh,'String',int2str(m_Data));



% --------------------------------------------------------------------
function m_save_Callback(hObject, eventdata, handles)
% hObject    handle to m_save (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global m_Data
global mData
xlswrite('newdata.xls',m_Data);
xlswrite('newdata.xls',mData);


% --------------------------------------------------------------------
function m_draw_Callback(hObject, eventdata, handles)
% hObject    handle to m_draw (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function m_one_Callback(hObject, eventdata, handles)
% hObject    handle to m_one (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x
x=-10:0.1:10;
y1=sin(2*x).*cos(x+5);
plot(x,y1);



% --------------------------------------------------------------------
function m_two_Callback(hObject, eventdata, handles)
% hObject    handle to m_two (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x
x=-10:0.1:10;
y1=sin(2*x).*cos(x+5);
y2=cos(2*x).*sin(x+3);
plot(x,y1,x,y2);



% --------------------------------------------------------------------
function m_line_Callback(hObject, eventdata, handles)
% hObject    handle to m_line (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function m_yellow_Callback(hObject, eventdata, handles)
% hObject    handle to m_yellow (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hh=findobj(gca,'type','Line')
set(hh,'color','yellow');



% --------------------------------------------------------------------
function m_black_Callback(hObject, eventdata, handles)
% hObject    handle to m_black (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hh=findobj(gca,'type','Line')
set(hh,'color','black');



% --------------------------------------------------------------------
function m_curve_dash_Callback(hObject, eventdata, handles)
% hObject    handle to m_curve_dash (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
hh=findobj(gca,'type','Line')
set(hh,'Linestyle','-.');



% --------------------------------------------------------------------
function m_datacolor_Callback(hObject, eventdata, handles)
% hObject    handle to m_datacolor (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)





% --------------------------------------------------------------------
function m_close_Callback(hObject, eventdata, handles)
% hObject    handle to m_close (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 ButtonName=questdlg('确定退出吗?', ...
                       '退出提示', ...
                       '确定','取消','取消');
   switch ButtonName,
     case '确定', 
     close;
     case '取消',
     
   end



% --------------------------------------------------------------------
function m_fontsize_Callback(hObject, eventdata, handles)
% hObject    handle to m_fontsize (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%hh=findobj(gca,'type','Data')
%set(hh,'MarkerSize','6');

⌨️ 快捷键说明

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