how to save 120 figures in a folder defined by user and later retrieve it?

1 view (last 30 days)
i have to save all 120 subfigures and then later read it again to apply modification and i have to make it sure that figures dont overlap each other .suggest some code i am new to this MATLAB
help would be appreciated
Pawel Jastrzebski
Pawel Jastrzebski on 10 Apr 2018
What sort of modification do you wan to carry out on the .png graph in Matlab?

Sign in to comment.

Answers (1)

Pawel Jastrzebski
Pawel Jastrzebski on 10 Apr 2018
Edited: Pawel Jastrzebski on 10 Apr 2018
When you say 120-off figures:
  • Are these matlab figures .fig?
Also, see the code below that was used to create what is known as a matlab subplot . In this example I've created a grid of 32 subplots and it's barely readable.
  • Are you sure you want to use a subplot for all of the 120 figures?
  • Or 120 figures to be plotted in one graph?
NrOfSubPlots = 32;
PlotGridX = 8;
PlotGgridY = NrOfSubPlots/PlotGridX;
f(1) = figure;
%first plot
hold on
for i=2:NrOfSubPlots
The code below shows how to save figures to a .fig file and the read them back to Matlab and to the subplot:
% create plots
NrOfSubPlots = 10;
for i=1:NrOfSubPlots
f(i) = figure;
name = ['fig' num2str(i) '.fig']
clear f i name;
% this line checks how many .figs are in the current folder
% DIR returns a structure.
FigsInTheFolder = dir('*.fig');
HowMany = numel(FigsInTheFolder);
% load the figuers back to matlab
newF = figure;
for i = 1:HowMany
newF(i) = openfig(FigsInTheFolder(i).name,'invisible');
% subplot all figs
showF = figure;
for i = 1:HowMany
h(i) = subplot(1,HowMany,i);
  1 Comment
rikki on 11 Apr 2018
Edited: rikki on 11 Apr 2018
suppose in a folder u have 10 images r ...can u please tell how to read this folder and then display all sub images in 1 figure window without overlapping

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!

Translated by