필터 지우기
필터 지우기

How do use gplot as subplots in a for loop?

조회 수: 1 (최근 30일)
Brandon Lieberthal
Brandon Lieberthal 2019년 2월 22일
댓글: Brandon Lieberthal 2019년 2월 22일
Hello,
I'm am trying to produce a plot of 5 x 5 network graphs in a subplot formation. This is my Matlab code:
figure
hold on
for i = 1:25
[xdata,ydata,AdjMat] = makerandomnetwork();
subplot(5,5,i);
gplot(AdjMat,[xdata ydata],'k')
end
The problem is that all the other subplots are cleared whenever a new subplot is generated. Any advice?

채택된 답변

Gani
Gani 2019년 2월 22일
편집: Gani 2019년 2월 22일
Put hold on inside the loop.
figure
for i = 1:25
[xdata,ydata,AdjMat] = makerandomnetwork();
subplot(5,5,i);
gplot(AdjMat,[xdata ydata],'k')
hold on
end
  댓글 수: 1
Brandon Lieberthal
Brandon Lieberthal 2019년 2월 22일
Never mind, I figured it out. The makerandomnetwork() function I was using had a "close all" hidden in it. Thanks for your help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by