Openfig+hold on

25 ビュー (過去 30 日間)
Devang Bipinchandra Lad
Devang Bipinchandra Lad 2022 年 6 月 28 日
回答済み: Devang Bipinchandra Lad 2022 年 6 月 29 日
I want to open saved .fig files and hold on the same plot. But it always open on a new figure and ignores the hold on function.
Below is code Im using-
for i=1:length(percent)
figaddress = strcat(num2str(percent(i)),'_percent\Pushover_LS.fig');
P_fig(i)= openfig(figaddress,'visible');
hold on
grid off
end

採用された回答

Devang Bipinchandra Lad
Devang Bipinchandra Lad 2022 年 6 月 29 日
Just found the solution of opening figure and then plotting on the same plot
  1. first open the figure using hgload
  2. Copyobj is used to paste on a newly defined subplot with the same axis property
for i=1:length(percent)
figaddress = strcat(num2str(percent(i)),'_percent\Pushover_LS.fig');
P_fig(i)= hgload(figaddress); % open figure but make sure you don't close them
end
figure()
h=subplot(1,1,1); %define subplot of 1x1
for i=1:length(percent)
copyobj(allchild(get(P_fig(i),'CurrentAxes')),h) %copyobj of each figure on h subplot
end
title('Curve')

その他の回答 (1 件)

DGM
DGM 2022 年 6 月 28 日
openfig opens figures
hold toggles properties of axes
It doesn't make sense to try to put a figure inside an axes. Perhaps you meant to use the 'reuse' option for openfig() instead?
  3 件のコメント
Devang Bipinchandra Lad
Devang Bipinchandra Lad 2022 年 6 月 29 日
The axis limits, tick positions, labels and legends are all same. Only the data is different.
Devang Bipinchandra Lad
Devang Bipinchandra Lad 2022 年 6 月 29 日
Can I have an example?

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

カテゴリ

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

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by