Skip to content
Snippets Groups Projects
Verified Commit b6dd272b authored by Thomas Lambert's avatar Thomas Lambert :helicopter:
Browse files

feat(save): add overwrite option

parent 75ccd671
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,8 @@ function savecsv(ExpData, arduShort, tunnelData) ...@@ -20,6 +20,8 @@ function savecsv(ExpData, arduShort, tunnelData)
'Fx2', 'Fy2', 'Fz2', 'Mx2', 'My2', 'Mz2'}; 'Fx2', 'Fy2', 'Fz2', 'Mx2', 'My2', 'Mz2'};
SAMPLING = 1000; SAMPLING = 1000;
ALWAYS_OVERWRITE = true;
if isempty(arduShort) if isempty(arduShort)
tableHeader = STATIC_TABLE_HEADER; tableHeader = STATIC_TABLE_HEADER;
time = (0:1 / SAMPLING:(size(tunnelData, 1) - 1) / SAMPLING)'; time = (0:1 / SAMPLING:(size(tunnelData, 1) - 1) / SAMPLING)';
...@@ -36,12 +38,12 @@ function savecsv(ExpData, arduShort, tunnelData) ...@@ -36,12 +38,12 @@ function savecsv(ExpData, arduShort, tunnelData)
testCase, ExpData.dx * 100, ExpData.freq, ExpData.airspeed); testCase, ExpData.dx * 100, ExpData.freq, ExpData.airspeed);
savefile = fullfile('data/cleaned', dirSplits(1), filename); 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 % Merges the two arrays together and put it in table
size(time); size(time);
size(arduShort); size(arduShort);
size(tunnelData); size(tunnelData);
cleanedArray = [time, arduShort, tunnelData]; cleanedArray = [time, arduShort(:, 2:end), tunnelData];
cleanedTable = array2table(cleanedArray, ... cleanedTable = array2table(cleanedArray, ...
'VariableNames', tableHeader); 'VariableNames', tableHeader);
......
...@@ -10,12 +10,14 @@ function savemat(idFile, ExpData) ...@@ -10,12 +10,14 @@ function savemat(idFile, ExpData)
% MIT License % MIT License
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ALWAYS_OVERWRITE = true;
% Make filename % Make filename
[~, file, ~] = fileparts(idFile); [~, file, ~] = fileparts(idFile);
savedir = strsplit(file, '-'); savedir = strsplit(file, '-');
savefile = fullfile('data/cleaned_MAT', savedir(1), [file, '.mat']); 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'); save(string(savefile), 'ExpData');
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment