function recover(x)
% x stringa
% leggi il file x.cdr
% rimpolpalo 
% risalvalo come x_restored.cdr
% usare solo per file corti !
z=strcat(x,'.cdr');
infile=fopen(z,'r');
 a=fread(infile,[2,Inf],"int16","ieee-be");
fclose(infile);
n=size(a,2);
for i=1:n
for j=1:10
b(1,(i-1)*10+j)=a(1,i);
b(2,(i-1)*10+j)=a(2,i);
end
end
n=size(b,2);
z=strcat(x,'_restored.cdr');
outfile=fopen(z,'w');
for i=1:n
fwrite(outfile,int16(b(1,i)),"int16","ieee-be");
fwrite(outfile,int16(b(2,i)),"int16","ieee-be");
end 
fclose(outfile);
end
