Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Combine two matlab plotting commands to execute loops of figures

1 Ansicht (letzte 30 Tage)
George
George am 18 Jul. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 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 Kommentar
Michelle Hirsch
Michelle Hirsch am 24 Jul. 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

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by