From 023aca771c124ba2d0e8d0afe39d69ded7aa2f2f Mon Sep 17 00:00:00 2001
From: "AD\\WoudaFJ" <f.j.wouda@utwente.nl>
Date: Mon, 28 Aug 2023 16:14:40 +0200
Subject: [PATCH] Fixed bug where data was stored in the wrong field, added
 saving the results to Main.m

---
 +math/calculateSteps.m | 3 +++
 Main.m                 | 7 +++++--
 getCalibration.m       | 7 +------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/+math/calculateSteps.m b/+math/calculateSteps.m
index bb695b6..12c5873 100644
--- a/+math/calculateSteps.m
+++ b/+math/calculateSteps.m
@@ -47,4 +47,7 @@ for iStep = steps
     data = math.intSignals(data, calibration, iStep);
 
 end
+
+% Store the processed data in the original structure.
+dataStruct.(trialName) = data;
 end
\ No newline at end of file
diff --git a/Main.m b/Main.m
index 53dcd0a..3e201a0 100644
--- a/Main.m
+++ b/Main.m
@@ -30,8 +30,11 @@ for i = 3:length(subjectFolders)
         dataStruct.(subjectFolders(i).name).(trialName) = readDotCsv(currentPath);
 
         % calculate all values for each step.
-        dataStruct.(subjectFolders(i).name).(trialName) = ...
+        dataStruct.(subjectFolders(i).name) = ...
             math.calculateSteps(dataStruct.(subjectFolders(i).name), trialName);
 
     end
-end
\ No newline at end of file
+end
+
+% Store the data in a results mat file.
+save(join([fileFolder '\Results.mat'],''), 'dataStruct')
\ No newline at end of file
diff --git a/getCalibration.m b/getCalibration.m
index 9375003..48f63f1 100644
--- a/getCalibration.m
+++ b/getCalibration.m
@@ -27,12 +27,7 @@ function dataStruct = getCalibration(filePath)
         end
 
         % Determine the calibration orientation.
-        dataStruct.(trialName) = math.initOrien(dataStruct.(trialName));
-
-        
-
-        
+        dataStruct.(trialName) = math.initOrien(dataStruct.(trialName));       
 
     end
-
 end
\ No newline at end of file
-- 
GitLab