|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
我刚开始学gui编程,第一个程序编译成.exe后,运行的时候先出现错误提示如下:
然后就是程序界面一闪即逝。
请问这时什么引起的?
怎么修改?
谢谢!
源程序如下:
源程序如下:
function varargout = signal(varargin)
% SIGNAL M-file for signal.fig
% SIGNAL, by itself, creates a new SIGNAL or raises the existing
% singleton*.
%
% H = SIGNAL returns the handle to a new SIGNAL or the handle to
% the existing singleton*.
%
% SIGNAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SIGNAL.M with the given input arguments.
%
% SIGNAL('Property','Value',...) creates a new SIGNAL or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before signal_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to signal_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
% Edit the above test_data to modify the response to help signal
% Last Modified by GUIDE v2.5 25-Mar-2007 17:31:17
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @signal_OpeningFcn, ...
'gui_OutputFcn', @signal_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin & isstr(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 signal is made visible.
function signal_OpeningFcn(hObject, eventdata, handles, varargin)
%%%%%%WAITFORCALLBACKS(1)
% 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 signal (see VARARGIN)
% Choose default command line output for signal
%handles.output = hObject;
%handles.SIGNALGenerator=[];
% Update handles structure
%guidata(hObject, handles);
% UIWAIT makes signal wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = signal_OutputFcn(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% 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;
WAITFORCALLBACKS(1);
% --- Executes on button press in key3.
function key3_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Signal=PressKeyDown3(handles,'3');
handles.SIGNALGenerator=Signal;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in key1.
function key1_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%THE NEXT PART IS NOT THE PROGRAM BUILD AUTOMATICALLY
Signal=PressKeyDown1(handles,'1');
handles.SIGNALGenerator=Signal;
% Update handles structure
guidata(hObject, handles);
%% set(handles.test_data,'string','1')
% --- Executes on button press in key2.
function key2_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Signal=PressKeyDown2(handles,'2');
handles.SIGNALGenerator=Signal;
% Update handles structure
guidata(hObject, handles);
%set(handles.test_data,'string','0')
% --- Executes on mouse press over figure background.
function figure1_ButtonDownFcn(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over key1.
function key1_ButtonDownFcn(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function test_data_CreateFcn(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to test_data (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
function test_data_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to test_data (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of test_data as test_data
% str2double(get(hObject,'String')) returns contents of test_data as a double
Signal=OpeningFcn(handles,'test_data')
handles.SIGNALGenerator=Signal;
% Update handles structure
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function key3_CreateFcn(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes on button press in key4.
function key4_Callback(hObject, eventdata, handles)
%%%%%%WAITFORCALLBACKS(1)
% hObject handle to key4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Signal=PressKeyDown4(handles,'4');
handles.SIGNALGenerator=Signal;
% Update handles structure
guidata(hObject, handles);
set(handles.test_data,'string','')
[ 本帖最后由 angle3839 于 2007-4-22 10:59 编辑 ] |
-
-
|