MATLAB: How to determine if enter(return) was pressed

guimatlab gui

Hi,
in one part of my code I need to determine if enter(return) was pressed. I am useing simple part of code:
kkey = get(gcf,'CurrentCharacter');
if strcmp(kkey, %comparing parameter)
% my code
end
which works very well for every key imaginable except return key…when I try to examine it step by step I found that if I press for example number 1:
kkey = '1'
but when I press return field is suddenly 1x1char and blank…why is that ? shouldnt kkey variable be '13' like in the ascii that coresponds to return ??
From my point of view it's wierd…How can I than compare it ??
Thanks, Peter

Best Answer

Solution was simple and enough elegant for me...
.
function pushbutton1_KeyPressFcn(hObject, eventdata, handles)
key = get(gcf,'CurrentKey');
if(strcmp (key , 'return'))
pushbutton1_Callback(hObject, eventdata, handles)
end
function pushbutton1_Callback(hObject, eventdata, handles)
%code to be executed