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

📄 bheat.m

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

% Last Modified by GUIDE v2.5 09-May-2006 22:03:46

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

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

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = BHEAT_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



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit_Train_Epochs (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 edit_Train_Epochs as text
%        str2double(get(hObject,'String')) returns contents of edit_Train_Epochs as a double


% --- Executes during object creation, after setting all properties.
function edit_Train_Epochs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_Train_Epochs (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
user_data=get(gcf,'userdata');
t_data=str2double(get(hObject,'String'));
user_data.epochs=t_data;
set(gcf,'UserData',user_data);


function edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit3 as text
%        str2double(get(hObject,'String')) returns contents of edit3 as a double


% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (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 edit4_Callback(hObject, eventdata, handles)
% hObject    handle to edit4 (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 edit4 as text
%        str2double(get(hObject,'String')) returns contents of edit4 as a double


% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit4 (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 pb_Data_In_show.
function pb_Data_In_show_Callback(hObject, eventdata, handles)
% hObject    handle to pb_Data_In_show (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)
% 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 pb_Data_Import.
function pb_Data_Import_Callback(hObject, eventdata, handles)
% hObject    handle to pb_Data_Import (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;
LoadData=load('-mat',file.pathname);
T_Data=LoadData.huireInputData;
set(findobj('Tag','edit_DataIn_Show'),'String',num2str(T_Data));
T_Data=T_Data';
user_data.I_Data=T_Data;
plot( findobj('Tag','axes_Data_In'),(T_Data(1,:)+T_Data(2,:)+T_Data(3,:)+T_Data(4,:))/4,(T_Data(5,:)+T_Data(6,:)+T_Data(7,:))/3,'ro');
set(gcf,'userdata',user_data);





function edit_Train_Epochs_Callback(hObject, eventdata, handles)
% hObject    handle to edit_Train_Epochs (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 edit_Train_Epochs as text
%        str2double(get(hObject,'String')) returns contents of edit_Train_Epochs as a double
user_data=get(gcf,'UserData');
epochs=str2double(get(hObject,'String'));
user_data.epochs=epochs;
set(gcf,'UserData',user_data);





function edit_HLen_Callback(hObject, eventdata, handles)
% hObject    handle to edit_HLen (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 edit_HLen as text
%        str2double(get(hObject,'String')) returns contents of edit_HLen as a double
user_data=get(gcf,'UserData');
xlen=str2double(get(hObject,'String'));
user_data.xlen=xlen;
set(gcf,'UserData',user_data);





function edit_VLen_Callback(hObject, eventdata, handles)
% hObject    handle to edit_VLen (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 edit_VLen as text
%        str2double(get(hObject,'String')) returns contents of edit_VLen as a double
user_data=get(gcf,'UserData');
ylen=str2double(get(hObject,'String'));
user_data.ylen=ylen;
set(gcf,'UserData',user_data);



% --- Executes on button press in pb_SAT.
function pb_SAT_Callback(hObject, eventdata, handles)
% hObject    handle to pb_SAT (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(gcf,'UserData');
P=user_data.I_Data;
xsize=user_data.xlen;
ysize=user_data.ylen;
epoch=user_data.epochs;
net=newsom(minmax(P),[xsize ysize]);
net.trainParam.epochs=epoch;
net=train(net,user_data.I_Data);
y=sim(net,user_data.I_Data);
yc=vec2ind(y);
x=1:13;
plot(findobj('Tag','axes_Data_Out'),x,yc,'r*');
hold on;
grid on;
xlabel('纵坐标相同则属于同一类别');
hold off;




function edit_DataIn_Show_Callback(hObject, eventdata, handles)
% hObject    handle to edit_DataIn_Show (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 edit_DataIn_Show as text
%        str2double(get(hObject,'String')) returns contents of edit_DataIn_Show as a double




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




% --- Executes during object creation, after setting all properties.
function edit_HLen_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit_HLen (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
user_data=get(gcf,'userdata');
xlen=str2double(get(hObject,'String'));
user_data.xlen=xlen;
set(gcf,'userdata',user_data);



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

user_data=get(gcf,'userdata');
ylen=str2double(get(hObject,'String'));
user_data.ylen=ylen;
set(gcf,'userdata',user_data);

⌨️ 快捷键说明

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