-
Notifications
You must be signed in to change notification settings - Fork 0
/
retrieveAllVariables.m
43 lines (38 loc) · 1.44 KB
/
retrieveAllVariables.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% -- retrieveAllVariables(database)
% Retrieve all forces, times and coordinates from the database for each step
%
%%% Returns %%%
%%%
% time : max measurements x steps x subjects
% Times in which measurements occurred(1st dim) for each step (2nd dim) and
% each subject (3rd dim).
%%%
% force: max measurements x steps x subjects
% Force induced on each moment (1st dim) for each step (2nd dim) and each
% subject (3rd dim).
%%%
% x_coord: subjects x steps
% The step coordinates in x axis for all subjects(rows) and steps (col)
%%%
% y_coord: subjects x steps
% The step coordinates in y axis for all subjects(rows) and steps (col)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [time,force, x_coord, y_coord] = retrieveAllVariables(database)
for i=1:size(database,1) % All subjects
for j=1:size(database,2) % All Steps
% Retrieve measurements if not empty, else put nan
if ~isempty(database{i,j})
force(:,j,i)=database{i,j}.force;
time(:,j,i)=database{i,j}.time;
x_coord(i,j)=database{i,j}.x_step;
y_coord(i,j)=database{i,j}.y_step;
else
force(:,j,i)=nan;
time(:,j,i)=nan;
x_coord(i,j)=nan;
y_coord(i,j)=nan;
end
end
end
end