Read binary data through MATLAB

77 Views Asked by At

I have record the GPSL1 signal in the .bin format using USRP 2900 Parameters are:

Frequency = 1575.42M I/Q rate = 4M Gain = 25dB............... Now i want to extract tracking data in .mat form and in .dat form can you help me

fid = fopen('test01.bin', 'rb'); % Open .bin file in binary mode for reading data = fread(fid, 'int16'); % Read the data as unsigned 8-bit integers fclose(fid); % Close the file

% Perform parsing operations to extract tracking data and timestamp % Save the tracking data in a .dat file

fid = fopen('tracking_data.dat', 'wb'); % Open .dat file in binary mode for writing fwrite(fid, data, 'int16'); % Write the 'data' array to the .dat file fclose(fid); % Close the file

% Perform parsing operations to extract tracking data and timestamp

latitudeData = data(1:3:end); % Adjust the indexing based on the structure of the data longitudeData = data(2:3:end); % Adjust the indexing based on the structure of the data timestampData = data(3:3:end); % Adjust the indexing based on the structure of the data

% Save the tracking data in a .mat file trackingData = struct('latitude', latitudeData, 'longitude', longitudeData, 'timestamp', timestampData); save('tracking_data.mat', 'trackingData', '-v7.3');

0

There are 0 best solutions below