imu_allan/get_imudata.m

33 lines
920 B
Mathematica
Raw Normal View History

2023-10-19 20:16:43 +08:00
function data = get_imudata(filepath, dataStructArray)
%
fileID = fopen(filepath, 'r');
if fileID == -1
error('%s', filepath);
end
%
tline = fgetl(fileID);
while ischar(tline)
% 使
tokens = regexp(tline, '-?\d+\.\d+', 'match');
%
values = str2double(tokens);
%
if ~isempty(values)
epoch = values(1); %
dataStructArray(end + 1).time = epoch;
dataStructArray(end).values = values(2:end);
end
tline = fgetl(fileID);
end
%
fclose(fileID);
%
data = dataStructArray;
end