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

조회 수: 1 (최근 30일)
naygarp
naygarp 2018년 8월 6일
댓글: dpb 2018년 8월 7일
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에서 Configure Simulation Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by