How do i use the edit text box in a GUI to change variables in a function ???

5 vues (au cours des 30 derniers jours)
Hi, everyone
I'm new in Matlab and i am trying to make a GUI work like I want it too. I want to be able to change values in my function from the GUI. This is code I want to run in the GUI. e_epoch, e_show, e_LR, e_valid, e_goals are the variables I want to be able to control from the GUI.
function[net,tr]=backpropTrafo_1(e_epoch,e_show,e_LR,e_valid,e_goals);
%parameter
net.trainParam.epochs = e_epoch;
net.trainParam.show = e_show;
net.trainParam.lr = e_LR;
net.trainParam.max_fail = e_valid;
net.trainParam.goal = e_goals;
This is my GUI
I run its GUI. I put the string which is numeric into those 'edit textbox'. And then when I press pushbuttonPROSES, I want those variables that I've input on 'edit textbox' do calculate for function backpropTrafo_1. This is my code for callback function
function pushbuttonPROSES_Callback(hObject, eventdata, handles)
Data_latih=xlsread('Data_TRAFO1.xlsx','jst_trafo1','G61:K66');
Data_uji=xlsread('Data_TRAFO1.xlsx','jst_trafo1','G70:I75');
e_epoch=str2num(char(get(handles.editEpoch,'String')));
e_show=str2num(char(get(handles.editShow,'String')));
e_LR=str2num(char(get(handles.editLR,'String')));
e_valid=str2num(char(get(handles.editValid,'String')));
e_goals=str2num(char(get(handles.editGoals,'String')));
[net,tr]=backpropTrafo_1(e_epoch,e_show,e_LR,e_valid,e_goals);
When I pushed the pushbuttonPROSES in the GUI, I got back a error message that said:
Reference to a cleared variable e_epoch.
Error in backpropTrafo_1 (line 33)
net.trainParam.epochs = e_epoch;
Error in Simulasi>pushbuttonPROSES_Callback (line 214)
[net,tr]=backpropTrafo_1(e_epoch,e_show,e_LR,e_valid,e_goals);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in Simulasi (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Simulasi('pushbuttonPROSES_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
Why do i get this error? Thanks in advance for any and all help.
  3 commentaires
Febrian Dhimas Syahfitra
Febrian Dhimas Syahfitra le 6 Fév 2018
I don't know sir. So, what am I supposed to do ? Please, help me sir
Febrian Dhimas Syahfitra
Febrian Dhimas Syahfitra le 9 Fév 2018
Oh I see. Yeah I found 'clear' in my code. Thank you so much sir

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 6 Fév 2018
Search for the command "clear" in your code. Then find out, if it is needed there or if it destroys your data only. In the 2nd case, delete the command.

Plus de réponses (1)

Ira Miranti
Ira Miranti le 4 Août 2018
I have the same problem. But i'm not find 'clear' in my code. What i should do?

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by