Added script to calculate number of samples in a file

gr-droneid-3.8
David Protzman 2022-04-19 17:34:53 -04:00
rodzic 132f2c11c3
commit 7eff1d4c40
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,16 @@
% Get the number of complex 32-bit floating point values in the specified file
%
% @param file_path Path to the file that contains complex 32-bit floating point samples
% @return sample_count Number of complex 32-bit floating point samples in the provided input file
function [sample_count] = get_sample_count_of_file(file_path)
handle = fopen(file_path, "r");
if (handle == 0)
error("Could not open input file '%s'"', file_path);
end
fseek(handle, 0, 'eof');
byte_count = ftell(handle);
fclose(handle);
sample_count = floor(byte_count / 4 / 2);
end