Effacer les filtres
Effacer les filtres

Reset GUI Edit Text Field to Empty String

8 vues (au cours des 30 derniers jours)
Rachel McMurphy
Rachel McMurphy le 27 Oct 2019
Commenté : Walter Roberson le 6 Fév 2020
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 commentaires
Zuliana Nurfadlillah
Zuliana Nurfadlillah le 6 Fév 2020
how if i using GUIDE?
Walter Roberson
Walter Roberson le 6 Fév 2020
set( findobj(gcf, 'type', 'uicontrol', 'style', 'text'), 'string', '')

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Oct 2019
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 commentaire
Rachel McMurphy
Rachel McMurphy le 27 Oct 2019
Thank you! I thought I'd tried that before, but I guess I didn't do something right.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by