function [features] = getFeaturesFromF(F)

DEM = F2DEM(F);

%% pitch & roll
PITCH = F(101);
ROLL = abs(F(110));

%% line averages
LIN_AVGS = zeros(8,1);
index = 0;
for line = 9:16
    index = index + 1;
    DEM_line = DEM(line,:); 
    if (sum(isnan(DEM_line)) > 3)              % if there are more than 3 NaN in line
        LIN_AVGS(index) = NaN;                 % assign NaN
    else
        LIN_AVGS(index) = nanmean(DEM_line);   % compute average (exclude nan values)
    end
end

% standard deviation of line averages
LIN_AVGS_STD = nanstd(LIN_AVGS);

%% number of NaNs in front of robot:
NAN_INFO = isnan(LIN_AVGS(3:6));

%% gradient of averages
lin_averages = LIN_AVGS(isfinite(LIN_AVGS(3:end)));
gradient = diff(lin_averages);
GRAD_MAX = max(gradient);
if(isempty(GRAD_MAX))
    GRAD_MAX = NaN;
    GRAD_MAX_nan = 1;
else
    GRAD_MAX_nan = 0;
end
GRAD_MIN = min(gradient);
if(isempty(GRAD_MIN))
    GRAD_MIN = nan;
    GRAD_MIN_nan = 1;
else
    GRAD_MIN_nan = 0;
end
GRAD_MEAN = mean(gradient);

%% Features vector:
features = [PITCH;    % 1 value
    ROLL;             % 1 value
    LIN_AVGS;         % 8 values
    LIN_AVGS_STD;     % 1 value
    NAN_INFO;         % 4 values
    GRAD_MAX;         % 1 value
    GRAD_MAX_nan;     % 1 value
    GRAD_MIN;         % 1 value
    GRAD_MIN_nan;     % 1 value
    GRAD_MEAN;        % 1 value
    ];

end
