Check edit text for a symbol

조회 수: 1 (최근 30일)
Mahmoud Elshazly
Mahmoud Elshazly 2019년 10월 11일
답변: Adam Danz 2019년 10월 11일

Hello there,
I'm making a GUI for Compressible flow calculations in which i have 33 edit texts for all my variables. All the values pass through the algorithm and solve for each others (using knowns to get Unknowns). I want the user to be able to specify a certain unknown by typing "?" in editbox for which I can know that he only needs this value and represent it in a message box. How can I do the edit box check for "?" symbol in this case?

채택된 답변

Adam Danz
Adam Danz 2019년 10월 11일
The "String" property of your editbox contains the content of the text. You can use strcmpi() to determine whether the text box contains a "?" or not. The solution below also uses strtrim() to get rid of any unintended empty spaces.
isUnknown = strcmpi(strtrim(handles.Textbox1.String),'?');
Where handles.Textbox1.String is the handle to your editbox.
isUnknown will be a logical true/false.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by