[MITgcm-support] bathymetryread_help

Martin Losch Martin.Losch at awi.de
Mon Jun 2 02:42:41 EDT 2008


Maxiaohui,
that's really a matlab question. By default fread reads binary files  
into a vector. You could do either do "reshape(h,nx,ny)" or read  
h=fread(fid,[nx,ny],'real*4');

Martin

On 30 May 2008, at 15:56, Maxiaohui wrote:

> hi ,
> thank you  for Martin and Kolya's advice
> I have written a program to read bathymetry.bin in the  
> tutorial_global_oce_latlon example,the program is showed in the  
> following:
> clc;clear;
> nx=90;
> ny=40;
> h=ones(nx,ny);
> fid=fopen('D:\MITgcm\verification\tutorial_global_oce_latlon\input 
> \bathymetry.bin','r','b');
> h = fread(fid,'real*4');%since I use readBinaryPrec=32
> fclose(fid);
> but the h returned to be h(3600x1) with all the elements being 1
> what's wrong with my program? how the bathymetry.bin is stored?
>                                                                        
>               maxiaohui
>
> 雅虎邮箱,您的终生邮箱!
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support





More information about the MITgcm-support mailing list