zbhg.asv
来自「多元统计程序包」· ASV 代码 · 共 616 行 · 第 1/2 页
ASV
616 行
function varargout =zbhg(varargin)
% QUSHI M-file for qushi.fig
% QUSHI, by itself, creates a new QUSHI or raises the existing
% singleton*.
%
% H = QUSHI returns the handle to a new QUSHI or the handle to
% the existing singleton*.
%
% QUSHI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in QUSHI.M with the given input arguments.
%
% QUSHI('Property','Value',...) creates a new QUSHI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before qushi_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to qushi_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 text to modify the response to help qushi
% Last Modified by GUIDE v2.5 07-Nov-2003 21:32:24
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @qushi_OpeningFcn, ...
'gui_OutputFcn', @qushi_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
% End initialization code - DO NOT EDIT
if nargin<=1
fig2=openfig('hgui2.fig','reuse');
handles2=guihandles(fig2);
guidata(fig2,handles2);
%if nargin==0
% check_and_load([],handles1);
% elseif exist(varargin{1},handles1)
%check_and_load(varargin)
if nargin>0
varargout{1}=fig2;
end
elseif ischar(varargin{1})
try
[varargout{1:nargout}]=feval(varargin{:});
catch
disp(lasterr);
end
end
% --- Executes just before qushi is made visible.
function qushi_OpeningFcn(hObject, eventdata, handles2, 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 qushi (see VARARGIN)
% Choose default command line output for qushi
handles2.output = hObject;
% Update handles structure
guidata(hObject, handles2);
% UIWAIT makes qushi wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = qushi_OutputFcn(hObject, eventdata, handles2)
% 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} = handles2.output;
% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles2)% hObject handle to pushbutton1 (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 data_box_CreateFcn(hObject, eventdata, handles2)% hObject handle to data_box (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox 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% --- Executes on selection change in data_box.function data_box_Callback(hObject, eventdata, handles2)% hObject handle to data_box (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns data_box contents as cell array% contents{get(hObject,'Value')} returns selected item from data_box%function pass=check_and_load(file,handles1)
%pass=0;
%global x y
%end
%end
%if pass
% handles.x=data.x;
% handles1.Index=1;
% guidata(handles1.data_box,handles1)
%else
% --- Executes on button press in import_button.function import_button_Callback(hObject, eventdata, handles2)% hObject handle to import_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)[fname, pname] = uigetfile('*.mat', '打开数据文件');
global File
%如果打开文件对话框的"cancel"按钮被选择
if isequal([fname, pname], [0, 0])
return
%否则,转载文件全名,包括路径,并检验文件,转载它。
else
File = fullfile(pname, fname);
if isempty(File)
errordlg('您打开的不是一个有效的数据文件');
end
if exist(File)==2
data=importdata(File);
end
flds=fieldnames(data);
if length(flds)<2
errordlg('您打开的数据文件所含有的变量少于程序运行所需要的变量数,请重新导入数据文件');
elseif length(flds)>=2
set(handles2.data_box,'string',flds);
set(handles2.import_button,'enable','off');
set(handles2.ok_button,'enable','on')
end
end
end
%如果MAT文件有效的,存储文件名
%if Check_And_Load(File, handles1)
% handles1.LastFile = File;
% guidata(fig1, handles1)
%end
%end
% jl_data = importdata(File);
% str_jl_data = num2str(jl_data);
% set(handles1.data_box, 'String', str_jl_data);
% load(File);
%列出当前工作空间的变量供选择
% vars=evalin('base','who');
% panduan1=get(handles1.data_box,'string');
% if ~isempty(panduan1)
%非空,关闭“导入数据”按钮
% set(handles1.import_button,'enable','off');
%set(handles1.ok_button,'enable','on')
%end
%在当前工作空间中选择要用的变量
function [var1,var2,n,m,Fin,Fout]=get_var_names(handles2,File)
data=importdata(File);
datacell = struct2cell(data);
index_selected=get(handles2.data_box,'value');
if length(index_selected)~=2
errordlg('你选择的必须是两个变量','错误','modal');
else
var1=datacell{index_selected(1)};
var2=datacell{index_selected(2)};
input={'请输入数据的样本数n:','请输入自变量数m:','Fin','Fout'};
reps=inputdlg(input);
n=str2num(reps{1});
m=str2num(reps{2});
Fin=str2num(reps{3});
Fout=str2num(reps{4});
end
% --- Executes on button press in ok_button.function ok_button_Callback(hObject, eventdata, handles2)% hObject handle to ok_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) %在当前工作空间中选择要用的
global File x y Fin Fout
[var1,var2,n,m,Fin,Fout]=get_var_names(handles2,File);
if (size(var1)==[n,m]) & (size(var2)==[n,1])
x=var1;
y=var2;
set(handles2.data_box,'string',{'自变量矩阵:',num2str(x),'因变量矩阵:',num2str(y)});
elseif (size(var2)==[n,m]) & (size(var1)==[n,1])
x=var2;
y=var1;
set(handles2.data_box,'string',{'自变量矩阵:',num2str(x),'因变量矩阵:',num2str(y)});
set(handles2.run_button,'enable','on');
set(handles2.ok_button,'enable','off');
else
errordlg('您输入的的数据与m和n不匹配,请重新选择变量。若要重新导入数据文件请单击“重新开始”');
end
end
% --- Executes on button press in run_button.function run_button_Callback(hObject, eventdata, handles2)% hObject handle to run_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)global x y Fin Fout
x=[x y];
zbhg(x,Fin,Fout,handles2);
% --- Executes during object creation, after setting all properties.function outputdata_listbox_CreateFcn(hObject, eventdata, handles2)% hObject handle to outputdata_listbox (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox 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% --- Executes on selection change in outputdata_listbox.function outputdata_listbox_Callback(hObject, eventdata, handles2)% hObject handle to outputdata_listbox (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns outputdata_listbox contents as cell array% contents{get(hObject,'Value')} returns selected item from outputdata_listbox
% --- Executes on button press in restart_button.function restart_button_Callback(hObject, eventdata, handles2)% hObject handle to restart_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
set(handles2.data_box,'string','');
set(handles2.outputdata_listbox,'string','');
set(handles2.import_button,'enable','on');
set(handles2.ok_button,'enable','off');
set(handles2.run_button,'enable','off');
%eval('evalin(''base'',''who'')','beta')
%a=vars(1,1)
% --- Executes on button press in exit_button.function exit_button_Callback(hObject, eventdata, handles2)% hObject handle to exit_button (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close% --- Executes during object creation, after setting all properties.% --------------------------------------------------------------------function menu_Callback(hObject, eventdata, handles2, varargin)% hObject handle to menu (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function menu1_Callback(hObject, eventdata, handles2, varargin)% hObject handle to menu1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?