How to call a saved fig file

2 次查看(过去 30 天)
영탁 한
영탁 한 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