1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| clear all;
fclose ('all');
%Ouverture fichiers ".ech"
liste1='liste1.m';
filepath=['C:\Users\tahina\Documents\MATLAB\SONDAGES RUN\Avant 98\'];
filelist=[filepath liste1];
fid=fopen(filelist);
% Lecture des fichiers un par un
for i=1:3
filename1=fgetl(fid);
file1=[filepath filename1];
fid1=fopen(file1,'r');
%Lecture des donnees du fichier i
donnee1=fscanf(fid1,'%f',[5 inf]);
donnee1=donnee1';
alt1=donnee1 (:,1);
ozon1=donnee1 (:,5);
%max altitude
alt_max=max(alt1);
%Detection et supression NaN
where_NaN=isnan(ozon1);
alt1(where_NaN,:)=[];
ozon1(where_NaN,:)=[];
%Interpolation
altitude=0:0.015:alt_max;
altitude=altitude';
ozone=interp1(alt1,ozon1,altitude);
%matrice d'enregistrement
mat=fopen('mat_oz.m','a+');
fprintf(mat,'%f\n',ozone');
end
fclose('all'); |
Partager