フィルターのクリア

Is there a clever way to extract piece of x axis of the plot from a script and put it to another plot in another script

3 ビュー (過去 30 日間)
Hi I want to compare two solution's plots. Each are calcuated separate scripts.
Can I extract a piece of x axis of one solution and locate to another plot in another script?
I have
  • p1 plot whose x_axis( from 0 to 1) in script A
  • p2 plot x_axis( from 0 to 1) in the script B
Can I extract the p1 whose x_axis (from 0 to 0.1) and put it to the same plot as p2 in script B? Is there any shortcut? Thanks
  2 件のコメント
Adam
Adam 2015 年 4 月 30 日
編集済み: Adam 2015 年 4 月 30 日
How complicated is the plot? If it is just a simple image or line plot then can't you simply plot it again on the second axes from the result data, indexing into it appropriately for the data range you want?
Meva
Meva 2015 年 4 月 30 日
It is line plot. The increment dx =0.01 so I have 101 values inn each plots But I want to use first 11 values from the first plot and put the second graph.

サインインしてコメントする。

採用された回答

Joseph Cheng
Joseph Cheng 2015 年 4 月 30 日
well to do it programmatically you can do it through something like this using copyobj():
x1 = [0 1];
y1 = [0 1];
x2 = [0 2];
y2 = [0 5];
hfig(1)=figure(1);plot(x1,y1);
hfig(2)=figure(2);plot(x2,y2);
ax1 = get(hfig(1),'children');
ax2 = get(hfig(2),'children');
ax1plot = get(ax1(1),'children');
copyobj(ax1plot,ax2(1))
otherwise you can do it manually by using the plottools
  1. click on "Show Plot Tools and Dock Figure" in both figures
  2. click on one of the plot lines and copy [CTRL+C] or use drop down menu edit copy
  3. Paste or use [CTRL+V] in the other plot
  4. Then using the plot tools change the line properties to your liking

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by