필터 지우기
필터 지우기

hi,I wanted to know,if it is possible to plot some data in the same graph from two different M files?

조회 수: 2 (최근 30일)
I want to plot figures in the same graph from two different M-files? Is it possible?

채택된 답변

dpb
dpb 2016년 6월 29일
Sure. See
doc hold % 'on' after first to add to it
Of course, it the two m-files are user-belligerent and do things like 'close all' or create new figures then you'll have to go through some other gyrations to obtain the second dataset to add...
But, we can't tell what precisely would be required without more details than are given here...
  댓글 수: 2
nafila aytija
nafila aytija 2016년 6월 29일
I am sorry,I have no idea what user belligerent m-file is.The thing I am trying to do is to plot the (BER) curve from two different systems written in two different m-files? I tried with by not clearing the variables but it did not help.How can I do that?
dpb
dpb 2016년 6월 29일
"user belligerent" is the opposite of "user friendly" -- if the m-files are written where they don't consider the present state of the workspace and do things simply for their own convenience (like close all or make a new figure for their output instead of returning the data) then that's not conducive to doing something different that you're wanting to do.
Again, specifically, would need to know details beyond what are given; if you can return the necessary data from one or the other of the two m-files then you can use
hold on
plot(2ndMfileX,2ndMfileY)
on that figure axes to make the second line. If you can't get that data directly, you can do things like retrieve the 'XData','YData' properties from the second figure and use it to plot on the first. Or, there's copyobj that lets you get an element from one figure and make a copy of it in another.
But, what's the simplest is all dependent upon what we don't know which is what you have available to work from as a starting point.
Or, there's the possibility of writing another m-file that takes the necessary pieces from each of these two and melds them together if they're not the same...

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by