Matlab Movie

조회 수: 6 (최근 30일)
Nikhil
Nikhil 2011년 7월 27일
plot(ws(1,:),y,'r-+');
fig1 = gcf;
set(fig1, 'NextPlot','replacechildren');
winsize = get(fig1,'Position');
set(gca, 'XLim',[0 20],'YLim',[0 150]);
lim = gca;
for i = 1:noframes
plot(ws(i,:),y,'r-+');
axes = lim;
drawnow;
a(:,i) = getframe;
end
I am trying to visualize some data with time and need to make a movie with it, I researched a little and got to a point where i can genrate a movie but the axes in the movie keeps changing. And it makes no sense if i can't fix the axes and tried to do that with no avail, can anyone of you gurus look at this and give me some insights, into this.
Essentially i have vector ws at various time stamps in a variable and have a another vector which which is constant, so the y axis remains constant because i am always plotting ws against the same y but the x axis on which i plot ws keeps changing and i need to stop that.
thanks nk

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 7월 27일
axis([Xmin Xmax Ymin Ymax]);
  댓글 수: 1
Nikhil
Nikhil 2011년 7월 27일
tried that in the for loop it says that
??? Subscript indices must either be real positive integers or logicals.

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

추가 답변 (2개)

Nikhil
Nikhil 2011년 7월 27일
sorry man i guess i was using axis as a variable for something, i guess i didn't realize that, thanks a bunch though
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2011년 7월 27일
You have this line: axes=lim. Notice that axes is a built-in function.

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


Image Analyst
Image Analyst 2011년 7월 27일
Every time you plot, it blows away prior settings. So you need to determine your limits in advance and then after you call plot() with your new data (in your loop), issue calls to xlim() and ylim() to change the limits to your predetermined standard limits.
  댓글 수: 2
Nikhil
Nikhil 2011년 7월 27일
can you tell me a way to save xlim and ylim in a variable? i mean i get what you are saying but can't just implement it, i got it working now after changing the "axis" jiang was pointing out but i am still hard coding the limits.
Fangjun Jiang
Fangjun Jiang 2011년 7월 27일
AxisLimit=axis(gca);
axis(AxisLimit+10);
The same applies to xlim(),ylim() and zlim()

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

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by