Subplot after opening a saved figure

Hi, I have a collection of figures, each one consisting of 20 subplots (4x5). I want to open each subplot in turn and draw a couple of lines over the existing data. But as soon as I enter "subplot(4,5,1)," MATLAB deletes the top-left plot instead of selecting it. "hold on" has no effect on this behavior. Is there some other command that can help me select my data without deleting it?
Thanks!

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 6월 30일

1 개 추천

Or, if your previous figure is saved in a .fig file.
h=open('test.fig');
handles=findobj(h,'Type','axes');
You'll get the handles for those sub-plots. Then
axes(handles(1));
hold on;
plot(NewData);
Paulo Silva
Paulo Silva 2011년 6월 30일

0 개 추천

When you create a subplot get the handle for it like this h=subplot(...
When you want to have one subplot as current axes do axes(h)
Example
figure
for n=1:5
h(n)=subplot(5,1,n);
end
axes(h(2))
spy
pause(1)
axes(h(5))
spy

댓글 수: 4

Dustin
Dustin 2011년 6월 30일
Thanks!
Fangjun Jiang
Fangjun Jiang 2011년 6월 30일
@Paulo, Hah! That is how you propaganda your picture!
Paulo Silva
Paulo Silva 2011년 6월 30일
Yes it is, I use the spy for many tests, love that 3 letters function :)
Fangjun Jiang
Fangjun Jiang 2011년 6월 30일
You need to add "hold on" after selecting axes.

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

카테고리

질문:

2011년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by