function data = readResultData(result, pbeDef)
% read out data from result into matrix

% numbers
nTime = length(result);
nSample = size(pbeDef.seeding.positionMatrix, 2);
% init output
data.timeVector = nan(1, nTime*nSample);
data.hcMatrix = nan(pbeDef.dec.nC, nTime*nSample);

% gather output
for iTime = 1:nTime
    thisNSample = size(result(iTime).hcMatrix, 2);
    % add times:
    data.timeVector((iTime-1)*nSample + (1:thisNSample)) = ...
        result(iTime).time;
    % add vectors
    data.hcMatrix(:, (iTime-1)*nSample + (1:thisNSample)) = ...
        result(iTime).hcMatrix;
end

% cleanup
data.hcMatrix(:, isnan(data.timeVector)) = [];
data.timeVector(isnan(data.timeVector)) = [];