How do i use the edit text box in a GUI to change variables in a function ???
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Febrian Dhimas Syahfitra
il 4 Feb 2018
Risposto: Ira Miranti
il 4 Ago 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 Commenti
Risposta accettata
Jan
il 6 Feb 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.
Più risposte (1)
Ira Miranti
il 4 Ago 2018
I have the same problem. But i'm not find 'clear' in my code. What i should do?
0 Commenti
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!