Borrar filtros
Borrar filtros

How to call a saved fig file

3 visualizaciones (últimos 30 días)
영탁 한
영탁 한 el 15 de Feb. de 2023
Respondida: Jai Khurana el 15 de Feb. de 2023
I want to output multiple saved fig files to one figure. I would appreciate it if you could tell me how.

Respuestas (1)

Jai Khurana
Jai Khurana el 15 de Feb. de 2023
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

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by