Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Combine two matlab plotting commands to execute loops of figures

조회 수: 1 (최근 30일)
George
George 2014년 7월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
I am a new user in matlab, i have two separate commands and would like to combine them so as to produce figures in a loop with a specific pause
these are the two separate approaches
1. Create the base figure from A , A2, A3 , ... An
who A*
filenames = who('A*')
for i=1:3
pause(2);contourf(eval(filenames{i})),colorbar
end
2. Second portion is to superimpose a quiver with B, B1, B2 ....N and C,C2,C3,...n
[nx,ny]= size(A)
xx=1:1:ny;
yy=1:1:nx;
pause(2);contourf(eval(xx,yy,A)),colorbar
hold on
delta = 8;
quiver(xx(1:delta:end),yy(1:delta:end),B(1:delta:end,1:delta:end), ...
C(1:delta:end,1:delta:end),1)
hold off
3. I tired to combine them but i think i am missing something, probably the eval ?
filenames = who('A*')
B10 = who('B')
C10 = who('C')
for i=1:3
[nx,ny]= size(A)
xx=1:1:ny;
yy=1:1:nx;
pause(2);contourf(eval(xx,yy,filenames{i})),colorbar
hold on
delta = 8;
quiver(xx(1:delta:end),yy(1:delta:end),B10{i}(1:delta:end,1:delta:end), ...
C10{i}(1:delta:end,1:delta:end),1)
hold off
end
Any help is welcome
  댓글 수: 1
Michelle Hirsch
Michelle Hirsch 2014년 7월 24일
George -
Could you explain more of what you are trying to achieve by using eval? I almost always find that there's a better option than using eval, leading to code that's more robust and typically a fair bit easier to read.
-Michelle

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by