How do I merge 3 figures from 3 different programs in a single figure ?

1 view (last 30 days)
I have 3 figures from 3 different codes and I want to merge all the 3 figures in a single figure.
I could merge 2 figures from 2 different codes using 'copyobj'.
But I'm unable to merge for 3 figures, I tried using the following code but I get an error.
f1 = figure;
my_work
f2 = figure;
shooting_method_scientific_rana_ode45
f3 = figure;
shooting_method_scientific_rana_ode45_2
copyobj(f3.Children.Children.Children, f2.Children, f1.Children)
I receive the following error
Error using copyobj
Too many input arguments.
Error in matching_result_3 (line 7)
copyobj(f3.Children.Children.Children, f2.Children, f1.Children
Is there a way to merge the 3 figures?
I also have attached the 3 m files here

Answers (1)

dpb
dpb on 6 Aug 2018
Syntax for copyobj is two arguments, the handle (vector) of things to retrieve and the handle of the target.
I've no idea whether the syntax of f3.Children.Children.Children makes any sense at all or not, or whether that's somehow related to your having three figures, but presuming there is something that deeply nested, the (approximate) syntax would be something like
hFNew=figure; % create the target
copyobj([f3.Children.Children.Children, f2.Children, f1.Children],hFnew)
Whether that would actually work will depend entirely on just what is in the three figures f1, f2, f3 and whether those above expressions actually return something or not.
  2 Comments
naygarp
naygarp on 7 Aug 2018
I might have got the syntax of 'copyobj' wrong with
copyobj(f3.Children.Children.Children, f2.Children, f1.Children)
So, is there any other way to merge the three figures in a single figure by 'copyobj' or any other function.
dpb
dpb on 7 Aug 2018
As Answer shows, put the "from" handles in a vector as first argument, "to" as the second...

Sign in to comment.

Categories

Find more on Configure Simulation Conditions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!