Assigning strings to GUI buttons from an mfile?
1 view (last 30 days)
Show older comments
I'm just starting to get to grips with the Matlab GUI. I'm trying to build a response interface for a serial recall task. I want a series of buttons, each of which has a letter on it (i.e. string). when the button is pushed, the letter appears in a text box, reflecting the order in which the buttons were pushed. One box per button. The catch is that the string assigned to each button needs to be different on every trial, so I can't just set it using the property inspector. I assume this can be assigned from an mfile, but I'm not sure how! Any help appreciated.
0 Comments
Answers (1)
Daniel Aldrich
on 25 Feb 2015
To change the string of a button from inside the mfile you have to use the set function in the following manner:
%Sets the String of button, Button_Tag, to 'string goes here'
set(handles.Button_Tag,'String','string goes here')
%Forces the figures to update with minimal delay
drawnow
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!