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!