How to call a saved fig file

조회 수: 1 (최근 30일)
영탁 한
영탁 한 2023년 2월 15일
답변: Jai Khurana 2023년 2월 15일
I want to output multiple saved fig files to one figure. I would appreciate it if you could tell me how.

답변 (1개)

Jai Khurana
Jai Khurana 2023년 2월 15일
Hi,
To output multiple saved fig files to one figure, you can use the "openfig" function to open each saved fig file as a separate figure, and then copy the contents of each figure to a single figure using the "copyobj" function. Here's an example code snippet that demonstrates this:
% Specify the file names of the saved fig files
fileNames = {'figure1.fig', 'figure2.fig', 'figure3.fig'};
% Create a new figure to combine the saved fig files
combinedFig = figure();
% Loop through each saved fig file
for i = 1:length(fileNames)
% Open the saved fig file as a separate figure
figHandle = openfig(fileNames{i});
% Get the handle to the axes object in the separate figure
axesHandle = gca(figHandle);
% Copy the axes object from the separate figure to the combined figure
copyobj(axesHandle, combinedFig);
% Close the separate figure
close(figHandle);
end

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by