I have a reset button on my app, and 5 edit field (text) for various inputs. When pressing the reset button, it's supposed to clear the 5 text boxes to empty strings. I've tried other suggestions from other questions (like using 'set' and 'findobj') but none of them have worked. My professor said to create a string first, then set it to empty with our code, and test it with 'isempty' but he gave no further explanation.

댓글 수: 4

Walter Roberson
Walter Roberson 2019년 10월 27일
Using GUIDE or App Designer ?
Rachel McMurphy
Rachel McMurphy 2019년 10월 27일
App Designer
how if i using GUIDE?
set( findobj(gcf, 'type', 'uicontrol', 'style', 'text'), 'string', '')

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 27일

1 개 추천

app.edit1.Value = '';
app.edit2.Value = '';
app.edit3.Value = '';
app.edit4.Value = '';
app.edit5.Value = '';
if isempty(app.edit3.Value)
disp('Yes it is empty');
else
disp('No it is not empty');
end

댓글 수: 1

Rachel McMurphy
Rachel McMurphy 2019년 10월 27일
Thank you! I thought I'd tried that before, but I guess I didn't do something right.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by