How do i use the edit text box in a GUI to change variables in a function ???
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Febrian Dhimas Syahfitra
el 4 de Feb. de 2018
Respondida: Ira Miranti
el 4 de Ag. de 2018
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 comentarios
Respuesta aceptada
Jan
el 6 de Feb. de 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.
Más respuestas (1)
Ira Miranti
el 4 de Ag. de 2018
I have the same problem. But i'm not find 'clear' in my code. What i should do?
0 comentarios
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!