Matlab script for loading binary data into a table (example for a blog post)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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