How would I move an image along the x or y axis by clicking a button?
I have imported the image with ‘image = imread(‘image.jpg’);’ and then use ‘Left = uicontrol(‘Parent’, gcf, ‘Style’, ‘pushbutton’, ‘String’,’Left’,…’, but I am stuck there. I would like to move the image in any direction.
You can create a simple callback function for the pushbutton, that changes
XLimandYLimproperties of axes showing the image.Save the original limits:
For example to move image to the left:
To move up:
To restore the original position:
UPDATE:
Here is a working sample code (without using GUIDE):