function retval = LoadRigidBodyResults (directory, RigidBodyDObjectName)

if(directory(end) ~= '/')
directory = [directory '/'];
end

if(RigidBodyDObjectName(end) ~= '/')
RigidBodyDObjectName = [RigidBodyDObjectName '/'];
end



filenames = {'accel',...
          'cablePointConnection',...
          'CG',...
          'forces',...
          'position',...
          'results',...
          'velocity',...
          'airgap'};
          
opts = delimitedTextImportOptions;
opts.Delimiter = ' ';
opts.CommentStyle = '#';
opts.TrailingDelimitersRule = 'ignore';           
          
for i = 1:length(filenames)
          %cmd = ['retval.' filenames{i} ' = load(''' directory CableDObjectName filenames{i} '.dat'');'];
          cmd = ['retval.' filenames{i} ' = str2double(table2array(readtable(''' directory RigidBodyDObjectName filenames{i} '.dat'',opts)))']
          disp(['loading ' filenames{i} '.dat']);
          eval(cmd);
end          


