How do i fix the Colorbar scale when i run an animation?

조회 수: 1 (최근 30일)
xinyu cui
xinyu cui 2016년 4월 5일
편집: Walter Roberson 2016년 4월 5일
this is the part of code for plotting. does the colorbar could be set up outside my 'for' loop?
for i8 = 1:1000:length(t);
delete(findobj('tag','Update'));
grid on
axis([0,2*b,0,2.2,min(min(dy))-0.1,max(max(dy))*1.2]);
hold on
surf([0.3,0.2+b],[dx,dx],[dy(:,i8),dy(:,i8)],'tag','Update','LineWidth',2);
if abs(max(dy(:,i8))-max(max(dy)))<=0.001;
caxis = [0,max(max(dy))];
hold on
c = colorbar;
c.Label.String = 'Displacement(inch)';
end
pause(0.0000001)
end

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 5일
Before the hold on,
caxis([0,max(y(:))])
Note by the way that you are setting the limit by the maximum of y, not by the maximum that you will plot, as you only plot one in 1000
  댓글 수: 1
xinyu cui
xinyu cui 2016년 4월 5일
thx for reply. i test your method by re-set caxis by:
caxis([0,1000]);
However, it seems like the colorbar still change all the time when the displacement change in my animation.

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

카테고리

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