MATLAB: Change image after mouse over

axesguiguidemouse overwindowbuttonmotionfcn

I have a GUI set up at the moment with one component being an axes that is holding an image. What I want is when the user mouses over the axes/image the image changes to something else.
How would I go about doing something like this using the WindowButtonMotionFcn?
First I am not sure how I make this function work with an axes, and second I do not know where to place it with the code.
All the sources I have read do not use it the in the GUIDE GUI .m file, and instead in their own functions.
In the GUIDE GUI .m there doesn't seem to be any place to constantly check to see whether or not a mouse over has occurred.

Best Answer

You cannot have WindowsButtonMotionFcn for the axes, but you can have it for the figure. Just select the GUI figure, right click-> view Callbacks and choose WindowsButtonMotionFcn. This should create one for you in the MATLAB file.
I had sample code in there as:
function figure1_WindowButtonMotionFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[posx, posy ]= get(hObject,'CurrentPoint');
% Write your code to Check to see if the mouse is over the axes
if (checkoveraxes...)
plot(handles.axes1,rand(10)); % Change image, here i'm just plotting
end