CONTOUR_SEQUENCE is a MATLAB program which reads a sequence of (X,Y,U(X,Y)) datasets, creates contour plots, and saves them as PNG files which can be combined into an animation (by Quicktime Pro, for instance).
Although this program can handle a single input file, its most useful application is in processing many files, with 'consecutive' names, such as "fred01.txt", "fred02.txt", "fred03.txt" and so on. The user only has to tell the program to process the first file, and it will automatically continue to process files until it reaches the end of the sequence of names.
Each input data file is assumed to store location values X and Y, and an associated scalar U, at a regularly spaced grid. The grid does not have to be evenly spaced, but for this program to work, it must be the case that the (X,Y) points form an M by N grid, and that the value of X or of Y is constant along a grid line.
(In other words, a square grid is fine, but a rectangular grid is OK too. A rectangular grid with constant spacing is fine, but a rectangular grid with variable spacing is OK. But a "wiggly" or curved grid is no good.)
Also, the points in the data file must be listed in a reasonable order, either by rows or by columns.
The program has to figure out the grid parameters M and N, and convert the vectors of data X, Y, U into doubly indexed arrays that can be handled by the MATLAB contour routine. Once the contour plot is displayed, an image of it is saved as a PNG file.
Once the first file is processed, the routine checks to see if there is a second "consecutive" file, and it so, it is also processed, and so on, until presumably all files in the sequence have been handled.
CLICK here to see the MP4 version of a sample animation.
CLICK here to see the AVI version of a sample animation.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
CONTOUR_SEQUENCE3 is a MATLAB program which expects two separate node coordinate files, one for the X coordinates and one for the Y coordinates, and a separate file for the scalar quantity.
CONTOUR_SEQUENCE4 is a MATLAB program which expects a separate node coordinate file of the XY coordinates, and a separate file for the scalar quantity.
PNG image files:
You can go up one level to the MATLAB source codes.