Matlab GUI - parameters passing in function used in button callback
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am calling a function encrypt(S,k) in encrypt button callback. I created the GUI using guide.
Here is the code for Encrypt function:
% --- Executes on button press in Encrypt. function Encrypt_Callback(hObject, eventdata, handles) s = get(handles.edit5,'String'); disp(s); %s = 'jyoti'; %plain text need to be stored from the edit box, user input global X; k = 'key'; % to be generated and stored by sender button... X = enc1(s,k); % X stores the cypher text set(handles.textStatus, 'String', X ); guidata(hObject, handles);
But when I pass s= ' any string', the enc1 works and when I try to store and pass the text from edit box, there comes the following errors:
Error in ==> enc1 at 12 if (ischar(s)==0)
??? Output argument "X" (and maybe others) not assigned during call to "C:\Users\Jyoti\Documents\MATLAB\MATLAB\enc1.m>enc1".
Error in ==> gui>Encrypt_Callback at 278 X = enc1(s,k); % X stores the cypher text
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> gui at 43 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)gui('Encrypt_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Help!
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!