How to change the text on a pushbutton in the code, not using property inspector
Mostrar comentarios más antiguos
We have one GUI where a user selects a region from a drop down menu, which is assigned to a number (1 through 6), we then pass that number to another GUI. The second GUI has two ouch buttons labeled city 1 city 2, but we need to change the string to actual city names based on what region the user selected. We set up an if statement for each region and within those if statements we can't figure out how to change the string that the user will see, or how to go about it.
Respuestas (1)
Geoff Hayes
el 19 de Abr. de 2015
Taylor - if you have created your GUI using GUIDE, then you can use the handles structure to access the push buttons and change their text. For example, if pushbutton1 is the name/tag for one of your push buttons, then you could change its text as
set(handles.pushbutton1,'String','Ottawa');
or two whichever city name you wish.
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!