How can I make a string entered in an "Edit Text" box become a variable?
显示 更早的评论
I'm trying to make a game of some sort where one part involves typing in text in an "edit text" box, and another user typing in text in another "edit text" box. In short, if the text matches, the 2nd player wins the game.
Right now, I'm having trouble trying to figure out how to get the string in the "Edit Text" box to be recognized as a variable from which it will be easy to compare other strings to.
What I've tried:
function GueText_CreateFcn(hObject, eventdata, handles) % hObject handle to GueText (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
B = get(GueText,'String');
Which doesn't work. I think I'm not using the "get" command properly and am not entering the proper handle.
Any ideas? Thanks for any help you can provide.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!