MATLAB: How to make the text that I enter into an edit text box update dynamically

MATLAB

I want to be able to update the text I enter into an edit box dynamically or in real-time.

Best Answer

This enhancement has been incorporated in Release 2011a (R2011a). For previous product releases, read below for any possible workarounds:
This is expected behavior of the Edit Box UICONTROL in MATLAB.
You can try using the 'keypressfcn' to grab the keyboard input. The attached two files demonstrate the ability of real-time text update. As you enter text into the upper edit box, the text will be copied to the edit box beneath it as you enter.
1. Please download the following two files:
test_keypressfcn.m
test_keypressfcn.fig
2. Execute the program.
3. A GUI will appear. Enter text in the upper edit box displayed in the GUI.
4. Observe the text in the lower editbox is updated dynamically or in real-time as you enter test in the upper edit box.
Please note that this will work only for text that is continuously entered in the editbox. If you type in between words already entered in the editbox the gui will not perform as expected. You will need to implement logic similar to the one in this example to get the behavior that you desire.