Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Combine two matlab plotting commands to execute loops of figures

1 vue (au cours des 30 derniers jours)
George
George le 18 Juil 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaire
Michelle Hirsch
Michelle Hirsch le 24 Juil 2014
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

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by