Research Group of Prof. Dr. M. Griebel
Institute for Numerical Simulation
maximize
next up previous
Next: VTK Up: IO and Visualization of Previous: Data Formats

MATLAB 5.x

UDF:
The MATLAB functions ReadUDF and WriteUDF read{write} an UDF file in MATLAB. To use them you must add AWFD/MATLAB/Sources/ to the MATLABPATH environment variable first. ReadUDF returns a data structure which contains the numerical data as a D-dimensional matrix, the dimensions and the coordinates of grid lines (AWFD produces files with equally spaced grid lines only). For example

A=ReadUDF('A') ; % read the file
surf(A.a) ;
WriteUDF('B',A,0,0) ; % make a copy of the file

reads the file 'A'. Let us assume this is a two-dimensional example. Then surf(A.a) plots a nice surface plot. For higher dimensions MATLAB's surf() command would complain about the dimension of A.a. Get more information in MATLAB by e.g. help ReadUDF; help WriteUDF.

Sparse:
The MATLAB function ReadSparse(<filename>,<component number>) reads the selected component from the given file and returns a struct. In case of two-dimensional grid one can generate a MATLAB sparse matrix from this struct and plot the grid point distribution by the spy() command:

a=ReadSparse('../../Data/Test/U.adp', 0 ) ;
m=2^a.L ;
g=sparse(a.index(:,1)+1 , m-a.index(:,2)+1 , a.val) ;
spy(g',0.1) ;
set(gca,'XTick',[],'YTick',[], 'XTickLabel',[], 'YTickLabel',[]) ;
xlabel('') ;



koster 2003-07-29