diff --git a/utils/savecsv.m b/utils/savecsv.m index 544a88e6582bc5cf35e877d9ad12c260703b36ee..6a9f7450c0db4316e9168afe7eff09fa34ae7e9f 100644 --- a/utils/savecsv.m +++ b/utils/savecsv.m @@ -20,6 +20,8 @@ function savecsv(ExpData, arduShort, tunnelData) 'Fx2', 'Fy2', 'Fz2', 'Mx2', 'My2', 'Mz2'}; SAMPLING = 1000; + ALWAYS_OVERWRITE = true; + if isempty(arduShort) tableHeader = STATIC_TABLE_HEADER; time = (0:1 / SAMPLING:(size(tunnelData, 1) - 1) / SAMPLING)'; @@ -36,12 +38,12 @@ function savecsv(ExpData, arduShort, tunnelData) testCase, ExpData.dx * 100, ExpData.freq, ExpData.airspeed); savefile = fullfile('data/cleaned', dirSplits(1), filename); - if ~exist(string(savefile), 'file') + if ~exist(string(savefile), 'file') || ALWAYS_OVERWRITE % Merges the two arrays together and put it in table size(time); size(arduShort); size(tunnelData); - cleanedArray = [time, arduShort, tunnelData]; + cleanedArray = [time, arduShort(:, 2:end), tunnelData]; cleanedTable = array2table(cleanedArray, ... 'VariableNames', tableHeader); diff --git a/utils/savemat.m b/utils/savemat.m index d592c115825fcb4c8036c444ae370d55da8875ec..32cce18217bbe3bcb9b45e102633f82fb3d9c02e 100644 --- a/utils/savemat.m +++ b/utils/savemat.m @@ -10,12 +10,14 @@ function savemat(idFile, ExpData) % MIT License %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + ALWAYS_OVERWRITE = true; + % Make filename [~, file, ~] = fileparts(idFile); savedir = strsplit(file, '-'); savefile = fullfile('data/cleaned_MAT', savedir(1), [file, '.mat']); - if ~exist(string(savefile), 'file') + if ~exist(string(savefile), 'file') || ALWAYS_OVERWRITE save(string(savefile), 'ExpData'); end end