The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: plotting inside for loop
Replies: 2   Last Post: Mar 6, 1997 11:33 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Douglas Sondak

Posts: 7
Registered: 12/7/04
plotting inside for loop
Posted: Mar 5, 1997 3:12 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am trying to set up a matlab demonstration which works as
follows. First, a fortran code is run, writing two data files.
The files are then read into matlab, and the results are plotted.
This works fine if I carry out this procedure once, but I need to
do it within a "for" loop. When I try the loop, a figure appears
after the first iteration, but no plot is drawn. The plot does not
appear until the final (in this case second) iteration has
completed. Does anyone know how I can get the plot to draw
every iteration? The .m file is shown below. By the way, this
is a simplified version of my final goal - one step at a time!
Thanks for any help you can offer.

Doug Sondak


for n = 1:2

% run plate


% read grid

fidg = fopen('grid.d','rt');
nx = fscanf(fidg,'%i',1);
ny = fscanf(fidg,'%i',1);
x = fscanf(fidg,'%f',[nx,ny]);
y = fscanf(fidg,'%f',[nx,ny]);

% read solution

fids = fopen('plate.d','rt');
idum = fscanf(fids,'%i',1);
idum = fscanf(fids,'%i',1);
dum = fscanf(fids,'%f',1);
dum = fscanf(fids,'%f',1);
dum = fscanf(fids,'%f',1);
dum = fscanf(fids,'%f',1);
phi = fscanf(fids,'%f',[nx,ny]);

% plot

shading interp


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.