Info

此问题已关闭。 请重新打开它进行编辑或回答。

Combine two matlab plotting commands to execute loops of figures

1 次查看(过去 30 天)
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