matlab GUI callback 函数实现
2012-03-18 19:07
519 查看
搞了一下午,看了些资料,终于弄好了matlab GUI中的回调函数。
效果图见底部~
umtitled3.m:
图片贴上:
design view:
result view:
property inspector:
效果图见底部~
umtitled3.m:
function varargout = untitled3(varargin) % UNTITLED3 M-file for untitled3.fig % UNTITLED3, by itself, creates a new UNTITLED3 or raises the existing % singleton*. % % H = UNTITLED3 returns the handle to a new UNTITLED3 or the handle to % the existing singleton*. % % UNTITLED3('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in UNTITLED3.M with the given input arguments. % % UNTITLED3('Property','Value',...) creates a new UNTITLED3 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before untitled3_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to untitled3_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 untitled3 % Last Modified by GUIDE v2.5 18-Mar-2012 16:58:53 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @untitled3_OpeningFcn, ... 'gui_OutputFcn', @untitled3_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 untitled3 is made visible. function untitled3_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 untitled3 (see VARARGIN) % Choose default command line output for untitled3 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes untitled3 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = untitled3_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; % --- Executes on button press in openfile. function openfile_Callback(hObject, eventdata, handles)%打开文件 global filep filep=OnFileOpen(); % hObject handle to openfile (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata, handles)%求取sift特征 global filep global im1 global des1 global loc1 [im1,des1,loc1] = sift(filep); showkeys(im1,loc1); % hObject handle to pushbutton2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % --- Executes on button press in pushbutton3. function pushbutton3_Callback(hObject, eventdata, handles)%写入txt文件 global im1 global des1 global loc1 fid=fopen('matrix.txt','w'); fprintf(fid,'%f',des1);%sift特征 fclose(fid); % hObject handle to pushbutton3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
图片贴上:
design view:
result view:
property inspector:
相关文章推荐
- MATLAB GUI ,2,使用MATLAB的函数来实现MATLAB GUI,part 4,小游戏
- MATLAB GUI ,2,使用MATLAB的函数来实现MATLAB GUI,part 1,图像、按钮和坐标轴
- MATLAB GUI ,2,使用MATLAB的函数来实现MATLAB GUI,part 3,全局变量,计时器和状态机
- MATLAB GUI ,2,使用MATLAB的函数来实现MATLAB GUI,part 5,imshow绘图方式以及主辅图像缓存
- OpenCV实现fft2、ifft2变换和matlab中psf2otf()函数的功能
- IIR滤波器设计(调用MATLAB IIR函数来实现)
- 动态加载MATLAB生成的dll并反射dll里的函数,实现多返回值的功能
- 包含激活函数的多层神经元网络及matlab实现
- matlab imregionalmax/imregionalmin 函数 C++实现
- matlab GUI入门实现字符串传递的功能
- matlab实现RBF的相关函数
- matlab—GUI实现摄像头人脸检测
- matlab GUI设计常用函数记录
- matlab中滤波器函数filter的C语言实现
- [置顶] matlab2c使用c++实现matlab函数开发配置全解
- OpenCV3.1实现matlab中strel('disk', n)函数
- MATLAB自带的svm实现函数与libsvm差别小议
- 使用axes函数在matlab绘图中实现图中图的绘制
- matlab实现最速下降法和dfp求函数最小值
- Linux下c++调用自己编写的matlab函数:通过mcc动态链接库.so实现