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

📄 s_people.m

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

% Last Modified by GUIDE v2.5 06-May-2006 18:43:40

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

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

% Update handles structure
guidata(hObject, handles);

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


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



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.SOMpopulData;
T_Data=T_Data';
user_data.I_Data=T_Data;
%subplot('position',[0.041 0.338 0.443 0.624]);
plot(findobj('Tag','axes_Data_In'),T_Data(1,:),T_Data(2,:),'r+');
set(findobj('Tag','edit_DataIn_Show'),'String',num2str(user_data.I_Data));
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
t_data=str2double(get(hObject,'String'));
user_data=get(gcf,'UserData');
user_data.epochs=t_data;
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
t_data=str2double(get(hObject,'String'));
user_data=get(gcf,'UserData');
user_data.xlen=t_data;
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
t_data=str2double(get(hObject,'String'));
user_data=get(gcf,'UserData');
user_data.ylen=t_data;
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]);
w1_init=net.IW{1,1};
%subplot('position',[0.041 0.338 0.443 0.624]);
plotsom(w1_init,net.layers{1}.distances);
hold on;
net=init(net);
net.trainParam.epochs=epoch;
net=train(net,P);
w1=net.IW{1,1};
plotsom(w1,net.layers{1}.distances);
hold on;
y=sim(net,user_data.I_Data);
Y=vec2ind(y);
SOMporesult(Y);
%plot(findobj('Tag','axes_Data_Out'),x,yc,'b*');




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;


⌨️ 快捷键说明

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