필터 지우기
필터 지우기

Is it possible to merge to graphs in one figure from two m files?

조회 수: 1 (최근 30일)
naygarp
naygarp 2018년 5월 5일
댓글: Ameer Hamza 2018년 8월 9일
I have a code implementing shooting method to solve 4 ODEs
I have saved in two different files, one is by using solver 'bvp4c' and the other is by solver 'ode45'
Now is it possible to merge the two graphs in one figure each from these two m files

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 5일
Yes, it is possible and there are many ways of doing it depending on the type of graphics object you have in the figure. Here is a sketch in which a line is copied from one axes to another using copyobj()
f1 = figure;
ax1 = axes(f1);
s1 = scatter(rand(1,100), rand(1,100));
f2 = figure;
ax2 = axes(f2);
l2 = plot(0:0.1:1, (0:0.1:1).^2);
copyobj(l2, ax1)
This will give you a general idea. To get a more concrete example, please share the type of graphic objects you have.
  댓글 수: 6
naygarp
naygarp 2018년 8월 9일
Could you show me to merge figures from three m files in a similar procedure as you showed in the above if it is possible.
Ameer Hamza
Ameer Hamza 2018년 8월 9일
The 2nd and 3rd files seem the same. However the method to merge three plots is as follow
f1 = figure;
proj;
f2 = figure;
shooting_method;
f3 = figure;
plot(0:0.1:1);
copyobj([f2.Children.Children f3.Children.Children], f1.Children)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by