file=uipickfiles('FilterSpec','c:/lidar/C17FSR/*.hpl');
nfiles=length(file);
length(file);
for j=1:nfiles
    [datapath, filename, ext, versn] = fileparts(char(file(j)));
    matfile=[datapath,'/matfiles/',filename,'.mat']
    disp(char(file(j)))
    pause(2)
    fid=fopen(char(file(j)));
    lidar=read_CSM(fid,0.0);
    fclose(fid)
    save(matfile,'lidar');
end