function varargout = trainingset(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @trainingset_OpeningFcn, ...
'gui_OutputFcn', @trainingset_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 trainingset is made visible.
function trainingset_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 trainingset (see VARARGIN)
% Choose default command line output for trainingset
handles.output = hObject;
movegui(gcf,'center');%将gui移到屏幕中间
% Update handles structure
guidata(hObject, handles);
global sample ;
sample = load('G:\A-scuter-learning\PatternRecognition\lz\Code\pattern\template.mat'); %读入数据
sumtmp=0;
for i=1:10
tmphandles=eval(['handles.text' num2str(i+1)]);
set(tmphandles,'string',num2str(sample.pattern(i).num));
sumtmp=sumtmp+sample.pattern(i).num;
end
set(handles.text12,'string',num2str(sumtmp));
%显示sample.pattern(1).feature(1,:),即数字0的第一个特征在数字特征图中
if sample.pattern(1).num
SetFeature(handles,'string',sample.pattern(1).feature(1,:));
end
SetFeature(handles,'enable','inactive');
% UIWAIT makes trainingset wait for user response (see UIRESUME)
% uiwait(handles.figure1);
function SetFeature(handles,PropertyName,feature)
% SetFeature(handles,'value',sample.pattern(1).feature(1,:));
% SetFeature(handles,'enable','on');
% SetFeature(handles,'enable','inactive');
flag=strcmp(PropertyName,'string');
if flag
for i=1:25
tmphandles=eval(['handles.feature' num2str(i)]);
set(tmphandles,PropertyName,feature(i));
end
else
for i=1:25
tmphandles=eval(['handles.feature' num2str(i)]);
set(tmphandles,PropertyName,feature);
end
end
function feature=GetFeature(handles)%在修改和新建样本时得到数字特征
feature=zeros(1,25);
for i=1:25
tmphandles=eval(['handles.feature' num2str(i)]);
feature(i)=str2num(get(tmphandles,'string'));
end
function number=GetNumber(handles)%取回单选按钮所指的数字
for i=0:9
tmphandles=eval(['handles.radiobutton' num2str(i)]);
tmp=get(tmphandles,'value');
if tmp==1
number=i;
return
end
end
% --- Outputs from this function are returned to the command line.
function varargout = trainingset_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;
% --- 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)
% --------------------------------------------------------------------
% 修改
% --------------------------------------------------------------------
% global newflag;
% newflag=0;
% SetFeature(handles,'enable','on');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
% 删除
% --------------------------------------------------------------------
% global sample;
% SetFeature(handles,'enable','inactive');
% number=GetNumber(handles)+1;
%
% if sample.pattern(number).num==0 %无样本就不用删除了
% return
% end
%
% sample.pattern(number).feature(sample.position,:)=[];
% if sample.position==sample.pattern(number).num%若已经是最后一个,删除一个后,把position位置前移
% sample.position=sample.position-1;
% end
% sample=sample.NumberMinus1(number);%对相应的样本数减1
%
% if sample.pattern(number).num %还有样本存在
% SetFeature(handles,'string',sample.pattern(number).feature(sample.position,:));
% else
% SetFeature(handles,'string',zeros(1,25));
% end
% set(handles.text13,'string',['样本号: ' num2str(sample.position)]);
%
% sumtmp=0;
% for i=1:10
% tmphandles=eval(['handles.text' num2str(i+1)]);
% set(tmphandles,'string',num2str(sample.pattern(i).num));
% sumtmp=sumtmp+sample.pattern(i).num;
% end
% set(handles.text12,'string',num2str(sumtmp));
% --- 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)
% --------------------------------------------------------------------
% 前一个
% --------------------------------------------------------------------
global sample
SetFeature(handles,'enable','inactive');
number=GetNumber(handles)+1;
if sample.position>1
sample.position=sample.position-1;
else
sample.position=sample.pattern(number).num;
end
SetFeature(handles,'string',sample.pattern(number).feature(sample.position,:));
set(handles.text13,'string',['样本号: ' num2str(sample.position)]);
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
% 后一个
% --------------------------------------------------------------------
global sample
SetFeature(handles,'enable','inactive');
number=GetNumber(handles)+1;
if sample.position < sample.pattern(number).num
sample.position=sample.position+1;
else
sample.position=1;
end
SetFeature(handles,'string',sample.pattern(number).feature(sample.position,:));
set(handles.text13,'string',['样本号: ' num2str(sample.position)]);
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
% 添加样品
% --------------------------------------------------------------------
% global sample newflag;
% newflag=1;%标志是新增样品,而不是修改
% SetFeature(handles,'enable','on');
% sample.position=1;
% SetFeature(handles,'string',zeros(1,25));
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
% 保存样品
% --------------------------------------------------------------------
% global sample newflag;
% SetFeature(handles,'enable','inactive');
% feature=GetFeature(handles);
% number=GetNumber(handles);
% sample=sample.Save(feature,number,sample.positi
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于matlab的手写数字识别系统 (1024个子文件)
handwriting.asv 22KB
4.bmp 6KB
1.bmp 6KB
7.bmp 6KB
5.bmp 6KB
2.bmp 6KB
6.bmp 6KB
3.bmp 6KB
8.bmp 6KB
9.bmp 6KB
0.bmp 6KB
testimg.bmp 3KB
15.bmp 3KB
17.bmp 3KB
11.bmp 3KB
33.bmp 3KB
32.bmp 3KB
4.bmp 3KB
16.bmp 3KB
27.bmp 3KB
13.bmp 3KB
24.bmp 3KB
39.bmp 3KB
40.bmp 3KB
29.bmp 3KB
31.bmp 3KB
18.bmp 3KB
1.bmp 3KB
22.bmp 3KB
7.bmp 3KB
5.bmp 3KB
37.bmp 3KB
14.bmp 3KB
12.bmp 3KB
30.bmp 3KB
19.bmp 3KB
2.bmp 3KB
6.bmp 3KB
10.bmp 3KB
36.bmp 3KB
26.bmp 3KB
3.bmp 3KB
34.bmp 3KB
8.bmp 3KB
9.bmp 3KB
21.bmp 3KB
20.bmp 3KB
28.bmp 3KB
25.bmp 3KB
35.bmp 3KB
38.bmp 3KB
23.bmp 3KB
15.bmp 3KB
17.bmp 3KB
11.bmp 3KB
33.bmp 3KB
32.bmp 3KB
4.bmp 3KB
16.bmp 3KB
27.bmp 3KB
13.bmp 3KB
24.bmp 3KB
39.bmp 3KB
40.bmp 3KB
29.bmp 3KB
31.bmp 3KB
18.bmp 3KB
1.bmp 3KB
22.bmp 3KB
7.bmp 3KB
5.bmp 3KB
37.bmp 3KB
14.bmp 3KB
12.bmp 3KB
30.bmp 3KB
19.bmp 3KB
2.bmp 3KB
6.bmp 3KB
10.bmp 3KB
36.bmp 3KB
26.bmp 3KB
3.bmp 3KB
34.bmp 3KB
8.bmp 3KB
9.bmp 3KB
21.bmp 3KB
20.bmp 3KB
28.bmp 3KB
25.bmp 3KB
35.bmp 3KB
38.bmp 3KB
23.bmp 3KB
15.bmp 3KB
17.bmp 3KB
11.bmp 3KB
33.bmp 3KB
32.bmp 3KB
4.bmp 3KB
16.bmp 3KB
27.bmp 3KB
共 1024 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
零分分分分
- 粉丝: 9
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功