MATLAB: How to accept only numbers in a edit text box

inputnumbersscripttext;

hi again, i need to input values at seven edit text box but i want to show a window withe erros alert when i input leters. using guide and callback functions it's easy but now i have this at the script:
Temp = uicontrol('style','edit',...
'units','pixels',...
'position',[25 364 101 31],...
'string','Inserir Temperatura.',...
'foregroundcolor','r',...
'callback',{@Temp_call});
pause(2)
S = get(0,'userdata');
str = '0';
set(Temp,'string',str,'foregroundcolor','k')
uicontrol(Temp)
function [] = Temp_call(varargin)
% Callback for secondary GUI editbox.
S = get(0,'userdata');
set(S.ed,'string',get(gcbo,'string')) % Set gui_passdata editbox string.
and with guide when i've done another project, i use this code:
input = str2num(get(hObject,'String'));
if (isempty(input))
set(hObject,'String','0')
end
guidata(hObject, handles);
can i use this code? i don't know how to use because there's no handles

Best Answer

Temp = uicontrol('style','edit',...
'units','pixels',...
'position',[25 364 101 31],...
'string','Inserir Temperatura.',...
'foregroundcolor','r',...
'callback','@Temp_call');
function Temp_call(src,eventdata)
str=get(src,'String');
if isempty(str2num(str))
set(src,'string','0');
warndlg('Input must be numerical');
end