Matlab GUI设计

Matlab设计图形用户界面

设计的比较简易,通过修改对象属性代码等可以更精细。



function varargout = Guide2(varargin)
% Simple example of Matlab GUI, by wanglei

% Last Modified by GUIDE v2.5 10-Nov-2016 17:04:09

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Guide2_OpeningFcn, ...
                   'gui_OutputFcn',  @Guide2_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 Guide2 is made visible.
function Guide2_OpeningFcn(hObject, eventdata, handles, varargin)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = Guide2_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;


% --------------------------------------------------------------------
function file_1_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_6_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_7_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_8_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_9_Callback(hObject, eventdata, handles)

% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1


% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
am_1=get(handles.radiobutton1,'value');
am_2=get(handles.radiobutton2,'value');
if am_1==1
    am=5;
else
    am=10;
end
fre1=get(handles.listbox1,'string')
whos fre1
n=get(handles.listbox1,'value');
fre=eval(fre1(n,:));
x=0:0.1:10;
axes(handles.axes1);
plot(am*sin(fre*x));



% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
close

% --------------------------------------------------------------------
function Untitled_10_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_11_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_12_Callback(hObject, eventdata, handles)
% --------------------------------------------------------------------
function Untitled_13_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function Untitled_14_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function Untitled_15_Callback(hObject, eventdata, handles)
% --- Executes on button press in pushbutton3.
function im1 = pushbutton3_Callback(hObject, eventdata, handles)

[fname,pname] = uigetfile('*.*');
im1 = imread([pname,fname]);
axes(handles.axes2);
imshow(im1);


% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)

% --- Executes on button press in listbox2.
function listbox2_Callback(hObject, eventdata, handles)

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
close

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)

filt1 = get(handles.listbox2,'string');
%whos filter1
%celldisp(filter1)
n = get(handles.listbox2,'value');
filter1 = char(filt1{n});

im1 = getimage(handles.axes2);
%H=fspecial('gaussian',n,sigma);
H   = fspecial(filter1);
im2 = imfilter(im1,H);
imshow(im2);


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值