www.gusucode.com > GPS仿真Matlab编程源码程序 > GPS仿真Matlab编程源码程序/cauc_convert_if_data.m
%%------------------------------------------------------------------------ % used to convert the GPS data for CAUC sampleing system % % the IF data is collected by cauc mode II by wenguihong %%------------------------------------------------------------------------ clc clear %%------------------------------------------------------------------------ % data file for p=2:3 input_file_name = ['e:\real_' int2str(p) '.dat']; output_file_name = ['e:\gps' int2str(p) '6M 8bit.dat']; %%------------------------------------------------------------------------- % the buffer input_buffer = zeros(1, 60000); output_buffer = zeros(1, 60000); %%------------------------------------------------------------------------- % the read file handle read_fid = fopen( input_file_name, 'r'); if read_fid ==-1 disp( 'can not open the file for read !, please check the file name and path !' ); end %%------------------------------------------------------------------------- % write the data to file write_fid = fopen(output_file_name, 'w' ); if write_fid ==-1 disp('can not open the file for writing !, please check the file name and path !' ); end %%------------------------------------------------------------------------- count = 60000; i=0; while (i<3650) %---------------------------------------------------------------------- %for debug % count=count-1; %---------------------------------------------------------------------- [input_buffer, count] = fread(read_fid, count, 'single'); %---------------------------------------------------------------------- output_buffer = input_buffer>0; output_buffer = 2*output_buffer-1; % out_buffer = input_buffer ; % output_buffer = input_buffer*2^4; %---------------------------------------------------------------------- % if(ii>20000) %skip first 2 second data [write_count] = fwrite(write_fid, output_buffer, 'int8'); %end i=i+1 end end %%------------------------------------------------------------------------- % read the file to buffer fclose(read_fid); fclose(write_fid); %%------------------------------------------------------------------------- % the end of the file