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

📄 bpnn.asv

📁 线性神经网络
💻 ASV
📖 第 1 页 / 共 2 页
字号:
function varargout = BPNN(varargin)
% BPNN M-file for BPNN.fig
%      BPNN, by itself, creates a new BPNN or raises the existing
%      singleton*.
%
%      H = BPNN returns the handle to a new BPNN or the handle to
%      the existing singleton*.
%
%      BPNN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in BPNN.M with the given input arguments.
%
%      BPNN('Property','Value',...) creates a new BPNN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before BPNN_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to BPNN_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 BPNN

% Last Modified by GUIDE v2.5 29-May-2006 03:12:48

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @BPNN_OpeningFcn, ...
                   'gui_OutputFcn',  @BPNN_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 BPNN is made visible.
function BPNN_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 BPNN (see VARARGIN)

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = BPNN_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 edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (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 edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (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


% --- Executes on button press in PCData.
function PCData_Callback(hObject, eventdata, handles)
% hObject    handle to PCData (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
pb_data=get(hObject,'userdata');
user_data=get(gcf,'userdata');
if(pb_data.state==1)
    set(hObject,'String','EndCreat');
    pb_data.state=2;
    str=sprintf('>> 数据采集中\n>> point=get(hObject,''CurrentPoint'');\n>> XPoint=point(1,1);\n>> YPoint=point(1,2);');
    set(findobj('Tag','edit7'),'String',str);
    set(hObject,'userdata',pb_data);
elseif(pb_data.state==2)
    set(hObject,'String','CreatData');
    pb_data.state=1;
    pb_length=1;
    user_data.datai=pb_data.x;
    user_data.datao=pb_data.y;
    set(findobj('Tag','EData'),'String',num2str(pb_data.x));
    set(findobj('Tag','EShow_Out'),'String',num2str(pb_data.y));
    set(gcf,'userdata',user_data);
    set(hObject,'userdata',pb_data);
end
    


% --- Executes on button press in PLData.
function PLData_Callback(hObject, eventdata, handles)
% hObject    handle to PLData (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[name,path]=uigetfile('*.mat','Load data set');
pathname=strcat(path,name); 
file.name=name;  file.path=path;  file.pathname=pathname;
targT=load('-mat',file.pathname);
plot(findobj('Tag','axes2'),targT.DInput,targT.DOutput,'r+');
LoadData.datai=targT.DInput;
LoadData.datao=targT.DOutput;
set(findobj('Tag','EData'),'String',num2str(LoadData.datai));
set(findobj('Tag','EShow_Out'),'String',num2str(LoadData.datao));
set(gcf,'userdata',LoadData);

str1=sprintf('>> 从.mat文件中装载数据\n>> 具体函数的用法可参考\n>>帮助文档');
str2=sprintf('\n>> [name,path]=uigetfile(''*.mat'',''Load data set'');\n>> pathname=strcat(path,name);');
str3=sprintf('\n>> targT=load(''-mat'',file.pathname);');
str=strcat(str1,str2,str3);
set(findobj('Tag','edit7'),'String',str);


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function EData_Callback(hObject, eventdata, handles)
% hObject    handle to EData (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 EData as text
%        str2double(get(hObject,'String')) returns contents of EData as a double
%user_string=get(hObject,'String');
%j=1;
%n=1;
%temp_string='';
%for i=1:length(user_string)
%    if(user_string(i)==' ')
%        temp=user_string(j:(i-1));
%        temp_string=[temp_string;temp];
%%       set(findobj('Tag','EShow_Out'),'String',temp_string);
%        j=i+1;
%        n=n+1;
%    end
%    if(i==length(user_string))
%       temp=user_string(j:length(user_string));
%        temp_string=[temp_string;temp];
%        set(findobj('Tag','EShow_Out'),'String',temp_string);
%    end
%end
%for i=1:length(temp_string(:,1))
%    user_entry(i)=str2double(temp_string(i,:));
%end
%%set(findobj('Tag','EShow_Out'),'String',temp_string);
%if isnan(user_entry)
 %   errordlg('You must enter a numeric value','Bad Input','modal')
%end
%set(gcf,'UserData',user_entry);


% --- Executes during object creation, after setting all properties.
function EData_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EData (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 EShow_Out_Callback(hObject, eventdata, handles)
% hObject    handle to EShow_Out (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 EShow_Out as text
%        str2double(get(hObject,'String')) returns contents of EShow_Out as a double
%str=get(gcf,'UserData');
%set(findobj('Tag','EData'),'String',str);


% --- Executes during object creation, after setting all properties.
function EShow_Out_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EShow_Out (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




% --- Executes during object creation, after setting all properties.
function PLData_CreateFcn(hObject, eventdata, handles)
% hObject    handle to PLData (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called




% --- Executes on mouse press over axes background.
function axes2_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axes2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
user_data=get(findobj('Tag','PCData'),'userdata');
if(user_data.state==2)
    point=get(hObject,'CurrentPoint');
    XPoint=point(1,1);
    YPoint=point(1,2);
    user_data.x(user_data.length)=XPoint;
    user_data.y(user_data.length)=YPoint;
    user_data.length=user_data.length+1;
    set(findobj('Tag','PCData'),'userdata',user_data);
    plot(hObject,XPoint,YPoint,'r+');
end



⌨️ 快捷键说明

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