Can we store multiple subplots under one dataframe?

3 views (last 30 days)
I was curious to know whether we can store the multiple subplots under one data frame, by which only by running that particular dataframe we will achive those saved subplots in it.
For an example, I've attached a code (its a small part from my project). Here as we can see, there are 4 subplots. Now, is there any possible way out to store these four subplots under one data frame so that next time we want these plots we all need to run that specific dataframe and not required to run this entire code.
b=rgb2gray(a);
BW1 = edge(b,'Canny');
BW2 = edge(b,'Sobel');
BW3 = edge(b,'Prewitt');
BW4 = edge(b,'roberts');
figure()
subplot(2,2,1);
imshow(BW1)
title("Canny");
subplot(2,2,2);
imshow(BW2)
title("Sobel");
subplot(2,2,3);
imshow(BW3)
title("Prewitt")
subplot(2,2,4);
imshow(BW4)
title("Roberts")
  1 Comment
Walter Roberson
Walter Roberson on 6 Jul 2022
If you are going to unaccept because the answer did not work for you, then it would help a lot if you were to discuss what did not work for you.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 6 Jul 2022
You can savefig() to save the figure, and openfig() the figure later.
The result would depend upon the value of a at the time that you did the savefig() . It would not act as some kind of "macro" to generate the images based upon whatever a value existed at the time you did the openfig()

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by