Warning, /verification/tutorial_global_oce_latlon/diags_matlab/mit_readfield.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 function h = mit_readfield(fname,dims,accuracy)
0002 %function h = mit_readfield(fname,dims,accuracy)
0003
0004 ieee='ieee-be';
0005
0006 [fid message] = fopen(fname,'r',ieee);
0007 if fid <= 0
0008 error([message ', filename: ', [fname]])
0009 end
0010
0011 v = fread(fid,accuracy);
0012 if length(v) == prod(dims)
0013 h = reshape(v,dims);
0014 elseif length(v) == prod(dims(1:end-1))
0015 h = reshape(v,dims(1:end-1));
0016 else
0017 error('dimensions do not match')
0018 end
0019 fclose(fid);
0020
0021 return