Edit boxes (uicontrol):
You need to set a KeyPressFcn callback.
The first time KeyPressFcn fires after the control gets focus, you can reliably retrieve the String property to find out what is already there.
After that, the String property will not be updated until the control loses focus or the user presses enter, so you need to keep track of every character yourself, keeping an internal buffer of what you have seen and what the current state is. You can update the String property yourself, but it will still read back what it had when the control gained focus, but your changes will affect what is retrieved once focus loss / enter pressed.
With KeyPressFcn in place, the uicontrol will not handle backspace / delete itself: you will need to recognize the characters and adjust your internal buffer accordingly. Most people who do this do not bother to recognize the cursor keys to support positioning within the input.
You will need to keep track of the state: + and - only permitted as the first character, period only accepted once, must have at least one digit before or after the period or on both sides of the period, but period by itself is not valid.