save GUI figure in matlab

前端 未结 1 1764
谎友^
谎友^ 2020-12-22 00:59

let us consider following program for graphical user interface

function varargout = quadratic(varargin)
% QUADRATIC MATLAB code for quadratic.fig
%      QUAD         


        
相关标签:
1条回答
  • 2020-12-22 01:34

    One of the quick and dirty approaches

    myGUI = quadratic;
    % ......
    % do something or wait until it's done...
    % ......
    print(myGUI, '-dpng', 'GUIOUT.png'); % save as .png
    print(myGUI, '-djpeg', 'GUIOUT.jpg'); % save as .jpg
    

    It will work fine if you only take a screenshot.

    However, if you encounter the problem for which the output picture does not have the same size as the figure on your screen (especially when saving as pdf), you will probably have to implement solutions describled in this article.

    or even better using fig2file may work for you.

    0 讨论(0)
提交回复
热议问题