Undefined function or variable in my simple project
Afficher commentaires plus anciens
Hi...
I tried to develop my simple project after studying matlab. but I have a problem that is when I press the process button (btnTrain), an error like this appears;
1) Undefined function or variable 'addressfile'.
2.) Error in try 01> btnTrain_Callback training_ data = file address (:, 1: 5);
Could you help me correct my code for that?
Please help me to correct my error code,
this is my code :
% --- Executes on button press in btnBrowse.
function btnBrowse_Callback(hObject, eventdata, handles)
proyek=guidata(gcbo);
[namafile,direktori]=uigetfile({'*.xls;*.xlsx','file excel(*.xls,*.xlsx)';'*.*','semua file(*.*)'},'buka file Excel');
alamatfile=fullfile(direktori,namafile);
xlRange='A1:E32';
set(handles.btnBrowse,'String','alamatfile');
[a,b,c]=xlsread(alamatfile,xlRange);
bar=size(c,1);
col=size(c,2);
rnames=linspace(1,bar,bar);
data=c(:,1:col)
data_latih=alamatfile(:,1:5);
target_latih=alamatfile(:,6)';
[m,n]=size(data_latih);
set(handles.tabel1,'Data',data);
guidata(hObject,handles);
% --- Executes on button press in btnTrain.
function btnTrain_Callback(hObject, eventdata, handles)
data_latih=alamatfile(:,1:5);
net=newff(minmax(data_latih),[30 20 20 20 1],{'tansig','logsig','logsig','logsig','purelin'},'traingdx');
learning_rate=str2double(get(handles.edit11,'String'));
epoch=str2double(get(handles.edit12,'String'));
goal=str2double(get(handles.edit13,'String'));
show=str2double(get(handles.edit14,'String'));
net.performFcn = 'mse';
net.trainParam.showWindow = true;
net.trainParam.showCommandLine = false;
net.trainParam.show = show;
net.trainParam.epochs = epoch;
net.trainParam.time = inf;
net.trainParam.goal = goal;
net.trainParam.min_grad = 1e-09;
net.trainParam.max_fail = 3000;
net.trainParam.lr = learning_rate;
net.trainParam.mc=0.95;
[net_keluaran,tr,Y,E]= train(net,data_latih,target_latih);
bobot_input = net_keluaran.IW{1,1};
bobot_bias_input = net_keluaran.b{1,1};
bobot_lapisan1 = net_keluaran.LW{2,1};
bobot_bias_lapisan1= net_keluaran.b{2,1};
bobot_lapisan2 = net_keluaran.LW{3,1};
bobot_bias_lapisan2= net_keluaran.b{3,1};
bobot_lapisan3 = net_keluaran.LW{4,1};
bobot_bias_lapisan3= net_keluaran.b{4,1};
bobot_lapisan4 = net_keluaran.LW{5,1};
bobot_bias_lapisan4= net_keluaran.b{5,1};
jumlah_iterasi = tr.num_epochs;
nilai_keluaran = Y;
nilai_error = E;
error_MSE = (1/n)*sum(nilai_error.^2);
save net.mat net_keluaran
% Hasil prediksi
hasil_latih = sim(net_keluaran,data_latih);
max_data = max(max('Data'));
min_data = min(min('Data'));
hasil_latih = ((hasil_latih-0.1)*(max_data-min_data)/0.8)+min_data;
set(handles.tabel_output,'Data',hasil_latih);
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!