Skip to content

Instantly share code, notes, and snippets.

@ennerf
Last active October 25, 2016 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ennerf/19b48406a066f6e946a0567a1a4de1ed to your computer and use it in GitHub Desktop.
Save ennerf/19b48406a066f6e946a0567a1a4de1ed to your computer and use it in GitHub Desktop.
Matlab script for loading binary data into a table (example for a blog post)
file = '<fileName>';
% Read raw values into vector
fileID = fopen(file);
values = fread(fileID, '*uint64', 'ieee-le');
fclose(fileID);
% Map values to corresponding columns
cols = {
'sequence'
't1'
't2'
't3'
't4'
'nanoTime'
'milliTime'
'source'
};
% Convert vector into table rows
nCols = length(cols);
data = table();
for i = 1:nCols
data.(cols{i}) = double(values(i:nCols:end));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment