Stop Displayed Image in UI Figure from being Moved by User

2 vues (au cours des 30 derniers jours)
crawler
crawler le 22 Fév 2019
Modifié(e) : crawler le 14 Mar 2019
Hi,
I have this piece of code to display a logo on a UI Axes that ives in a UI figure
Although it plots well, the image isnt fixed, and the user can simply move it about with the mouse.
How can I prevent this.
%display logo on axes
matlabImage = imread('Images\Logo.png'); %read image file
image(app.UIAxes,matlabImage); %plot image in UIAxes component
app.UIAxes.Visible = false; %make axes invisible
Thanks

Réponses (1)

Geoff Hayes
Geoff Hayes le 10 Mar 2019
Shakirudeen - actually, imshow does allow you to specify the axes to plot the image to
'Parent' — Parent axes of image object
axes object
Parent axes of image object, specified as the comma-separated pair consisting of 'Parent' and an axes object. Use the 'Parent' name-value argument to build a UI that gives you control of the figure and axes properties.
So you would do something like
imshow(myImage, 'Parent', axesHandle);
where axesHandle is the handle to the axes where you want the image to appear.
  1 commentaire
crawler
crawler le 14 Mar 2019
@Geoff Hayes, many thanks for your answer.
Yes you are right, I always seem to forget about the 'Parent' property.
However, after playing with it, I realised that my earlier presumption that 'imshow' works was actually wrong, as it basicaly behaves the same was as using 'image'.
I realised that the problem of the image being movable only occurs when the parent figure is a 'UIFigure'. Otherwise it works alright when using 'Figure', either using 'image' or 'imshow'.
That said, I would prefer not to switch to using 'Figure' so the problem still remains. I'll edit my question to reflect this.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by