Plotting inside a loop - reset axes values

조회 수: 2 (최근 30일)
Zachary Reinke
Zachary Reinke 2017년 11월 11일
댓글: Walter Roberson 2017년 11월 12일
Please see pic. I can't get the default values for he secondary axes to go away. They persistently stay on the plot
% Create figure
figure1 = figure;
x0=0;
y0=0;
width=24;
height=14;
set(figure1,'units','inch','position',[x0,y0,width,height]);
tStep = 5*0.05
for i = 1:1:100
L = W;
Y = Data(i,:,1);
X = Data(i,:,2);
St = Data(i,1,3);
index = round(St/0.05);
L(index) = 100;
L(index+5) = 100;
% Create axes
axes1 = axes('Parent',figure1,...
'Position',[0.0578034682080925 0.631751227495908 0.922928709055877 0.320785597381343]);
hold(axes1,'on');
% Create plot
plot(t,v,'Parent',axes1,'LineWidth',1.5);
% Create plot
plot([St,St],[80,-20],'Parent',axes1,'LineWidth',1.5,'Color',[1 0 0]);
% Create plot
plot([St + tStep,St + tStep],[80,-20],'Parent',axes1,'LineWidth',1.5,'Color',[1 0 0]);
hold(axes1,'off');
% Create ylabel
ylabel({'Voltage',''});
% Create xlabel
xlabel('Time');
% Create title
title('Desired Response');
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes1,[7 35]);
box(axes1,'on');
% Create axes
axes2 = axes('Parent',figure1,...
'Position',[0.0606936416184971 0.08 0.917148362235067 0.43],'nextplot','replaceall');
% Create plot
plot(X,Y,'Parent',axes2,'LineWidth',1,...
'Color',[1 0 0]);
% Create ylabel
ylabel({'Error',''});
% Create xlabel
xlabel('Amplitude');
% Create title
title('Error Sensitivity');
box(axes2,'on');
xlim(axes2,[0 4.9]);
pause(1.5);
cla(axes2,'reset');
  댓글 수: 3
Zachary Reinke
Zachary Reinke 2017년 11월 12일
I want the labels there. If you look closely at the picture there are two sets of numbers. I only want one set.
Walter Roberson
Walter Roberson 2017년 11월 12일
Unfortunately we do not have the values of some of your variables to test with. I do not see anything obvious

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by