/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/f77read_old.m
ViewVC logotype

Annotation of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/f77read_old.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch point for: MAIN, initial
Initial revision

1 cnh 1.1 % read3d(filename,nx,ny,nz) returns an array size(nx,ny,nz) read
2     % from a f77_unformatted the binary file (double precision) named
3     % by the string filename.
4     %
5     % eg. temp=read3d('T.bin',160,10,16);
6     %
7     function [arr] = read3d(file,nx,ny,nz)
8     fid=fopen(file,'r','b');
9     q=fread(fid,1,'uint32'); % read the initial 4 bytes used in f77_unformatted
10     arr=fread(fid,nx*ny*nz,'float64');
11     arr=reshape(arr,nx,ny,nz);
12     st=fclose(fid);

  ViewVC Help
Powered by ViewVC 1.1.22