run /home/ruoying/Software/opnml_matlab5/startup
path(path,'/home/ruoying/Software/timeplt/')

UVOF='oc391_2to14.060103.060503.m3d';
[UVO,gridname,year,ncol,gmt]=read_obs(UVOF);

ii=find((fix(UVO(:,3)) ~= 92858) & (fix(UVO(:,2)) ~= 49443));

temp=UVO(ii,:);

fm='%12.6f %12.6f %12.6f %12.6f %12.6f %12.6f %12.6f %12.6f \n';

fid=fopen('oc391_RHE.m3d','w')

fprintf(fid,'%s \n','XXXX')
fprintf(fid,'%s \n','stw2')
fprintf(fid,'%s \n','header line')
fprintf(fid,'%s \n','2003')
fprintf(fid,'%s \n','8')
for k=1:length(ii)
 fprintf(fid,fm,temp(k,:));
end

fclose(fid)
