Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
i have code in gui and if condition does's work why? please help me
조회 수: 1 (최근 30일)
이전 댓글 표시
M = xlsread('D:\traindata.xls')
N = xlsread('D:\testdata1.xls')
Training_set = M(1:100,2:10)
%specify training set
Target_set = M(1:100,10)
%specify target set
Testing_set = N(1,2:10)
%index=N(:,10)==0002-1;
%specify Testing set
Testing_Target_Set = N(1,11)
%specify Testing set,Target
%X = mapstd(Training_set');
%Y = mapstd(Target_set');
mynetwork = newrb(Training_set',Target_set',0,0.5,100,25)
%newrb(P,T,goal,spread,MN,DF) takes two of these arguments,
%PR x Q matrix of Q input vectors
%TS x Q matrix of Q target class vectors
%goalMean squared error goal (default = 0.0
%spreadSpread of radial basis functions (default = 1.0
%MNMaximum number of neurons (default is Q)
%DFNumber of neurons to add between displays (default = 25)
mynetwork.trainFcn='trainlm';
mynetwork.trainparam.min_grad=0.00000001;
mynetwork.trainparam.epochs=100;
mynetwork.trainparam.ir=0,4;
mynetwork.trainparam.max_fail=20;
%save mynetwork
D=sim(mynetwork,Testing_set')
%simulate network
xlswrite('D:\testdata1.xls',D',2)
%xlswrite(filename, M, sheet) writes matrix M to the specified worksheet sheet in the file filename
if D==1
L='Not Existing'
set(handles.text3,'String',L);
elseif D==2
K='Existing'
set(handles.text3,'String',K);
end
댓글 수: 1
답변 (1개)
Walter Roberson
2019년 4월 21일
radial basis networks are function approximations, and will seldom return exact integers -- especially since we do not know that the training targets are 1 or 2.
You should put in a breakpoint after simulation and look closely at the output D to see if it is exactly 1 or 2.
댓글 수: 2
Walter Roberson
2019년 4월 22일
Put in a breakpoint in the code, and examine to see what values are present for D. Look carefully, including looking at
D - floor(D)
to detect values that display like integers but are slightly different than an integer.
Your should attach your data files so other people can test.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!