필터 지우기
필터 지우기

How can I insert an image in App Designer in Matlab R2017b?

조회 수: 17 (최근 30일)
Beatriz Ruiz
Beatriz Ruiz 2018년 3월 16일
댓글: rmean 2019년 12월 27일
I want to put an image (.jpg for example) inside the UIFigure in App Designer. Thanks

채택된 답변

ALEJANDRO JAVIER USHINA ERAZO
ALEJANDRO JAVIER USHINA ERAZO 2018년 4월 17일
           % Fill figure with axes "ha" and remove tick labels
             app.ha.Position = [0 0 app.UIFigure.Position(3:4)];
            % Remove title, axis labels, and tick labels
            uistack(app.ha,top);
            title(app.ha, []);
            xlabel(app.ha, []);
            ylabel(app.ha, []);
            app.ha.XAxis.TickLabels = {};
            app.ha.YAxis.TickLabels = {};
            % Display image and stretch to fill axes
            I = imshow('Powerlines.jpg', 'Parent', app.ha,'XData', [1 app.ha.Position(3)],'YData', [1 app.ha.Position(4)]);
            % Set limits of axes
            app.ha.XLim = [0 I.XData(2)];
            app.ha.YLim = [0 I.YData(2)];

I hope it helps you

  댓글 수: 3
Irma
Irma 2019년 5월 29일
I have the same question? I've tried to put this oin startap callback function, but it doesn't work,
rmean
rmean 2019년 12월 27일
Create an Axes (2D). In this example it is named app.ha. Then you can copy this code in the startup function. If you Axes has another name, change the code.

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

추가 답변 (1개)

Melinda Toth-Zubairi
Melinda Toth-Zubairi 2019년 3월 25일
Starting in R2019a you can use the uiimage function to create an image component in App Designer Apps. See the following post for more information.

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by