MATLAB GUI GET SET ERROR

1 view (last 30 days)
Yusuf Oguzhan Turgut
Yusuf Oguzhan Turgut on 10 Jun 2019
Hello,
I am trying to design a GUI.
I have 5 edit texts named(q1,q2,q3,q4,q5). I cannot get these strings into (q1,q2,q3,q4,q5) . How can i get them
Start button's gui code:
allNumbers=0;
SymbolsShift={'"' '!' char(39) '^' '+' '%' '&' '/' '(' ')' '=' '?' '_'};
SymbolsAltGr={'@' '#' '$' '{' '[' ']' '}' char(92)};
SymbolsNormal={'*' '-'} ;
SymbolsDown={'<' '>' '.' ':' '|'};
SymbolsNumber={'1' '2' '3' '4' '5' '6' '7' '8' '9' '0'};
if allNumbers==1
allSymbols=[SymbolsNumber];
else
allSymbols=[SymbolsShift SymbolsAltGr SymbolsNormal SymbolsDown];
end
alpha1=0.7;
alpha2=0.3;
M=5;
%N=100;
N=15;
CorrectlyTyped=0;
tic
k=0;
actualCell=allSymbols([floor(length(allSymbols)*rand(M,1))+1]);
% % % % actualCell={char(92) char(92) char(39) char(39) char(92)};
actualMat=cell2mat(actualCell);
backSlashes=find(actualMat==char(92));
kk=1;
global forScreen
forScreen = [];
for jj=1:M
if ismember(jj,backSlashes)
forScreen(kk:kk+1)='\\';
kk=kk+2;
else
forScreen(kk)=actualMat(jj);
kk=kk+1;
end
end
set(handles.q1,'String', char(forScreen(1)));
set(handles.q2,'String', char(forScreen(2)));
set(handles.q3,'String', char(forScreen(3)));
set(handles.q4,'String', char(forScreen(4)));
set(handles.q5,'String', char(forScreen(5)));
Here is the user's input gui code
function input_Callback(hObject, eventdata, handles)
% hObject handle to input (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of input as text
% str2double(get(hObject,'String')) returns contents of input as a double
tic;
userinput = get(hObject,'String');
ts=toc;
disp(ts);
a = 5
tratio = ts/a ;
n = length(userinput);
if (n >= 6)
f = msgbox('YOUR CHARACTERS ARE MORE THEN 5 ','Error','error' )
elseif (n <= 4)
g = msgbox('YOUR CHARACTERS ARE LESS THEN 5 ','Error','error' )
end
get(handles.q1,'String');
get(handles.q2,'String');
get(handles.q3,'String');
get(handles.q4,'String');
get(handles.q5,'String');
set(handles.text10,'String', q1,q2,q3,q4,q5);
The idea of GUI : MATLAB give random characters in below 5 edit text box. Each one represents 1 character. Also, user will enter the same characters above the start and check buttons. I want to get those 5 values, compare with the user's input. How can i do that ?

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!