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

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

回答(1 个)

dpb
dpb 2018-8-6
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 个评论
naygarp
naygarp 2018-8-7
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 2018-8-7
As Answer shows, put the "from" handles in a vector as first argument, "to" as the second...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by