App designer - resizing axes to image size

조회 수: 37(최근 30일)
Teshan Rezel
Teshan Rezel 2021년 3월 18일
댓글: Rashed Mohammed 2021년 3월 23일
Hi folks,
I'm displaying a JPEG image in my app and currently, the axes stretch the image when the window is maximised. Is there a way to make the axes the same size as the image, so that it doesn't stretch the image to maximise the window?

채택된 답변

Rashed Mohammed
Rashed Mohammed 2021년 3월 22일
Hi Teshan,
Since you have mentioned axes, I'm assuming you are using uiaxes to display the image. However, MATLAB has uiimage function for displaying images inside applications. This function also has the Name-Value pair ScaleMethod giving users the control over how the image must be displayed when the component area changes.
Hope this helps
  댓글 수: 2
Rashed Mohammed
Rashed Mohammed 2021년 3월 23일
In the App designer component library, there is an Image component which can be used in the Design View tab. You can access the ScaleMethod property once the image component is present in the component area. Alternatively you can use the following code in the Code View
img = uiimage(app.UIFigure,'ScaleMethod','none','ImageSource','image.jpg')
Hope this helps

댓글을 달려면 로그인하십시오.

추가 답변(0개)


Find more on Interactive Control and Callbacks in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by