Home > FMAToolbox > IO > LoadPositions.m

LoadPositions

PURPOSE ^

LoadPositions - Read positions from file.

SYNOPSIS ^

function positions = LoadPositions(filename,rate)

DESCRIPTION ^

LoadPositions - Read positions from file.

  USAGE

    positions = LoadPositions(filename,rate)

    filename            position file name
    rate                optional sampling rate (if timestamps are not
                        provided in the file)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function positions = LoadPositions(filename,rate)
0002 
0003 %LoadPositions - Read positions from file.
0004 %
0005 %  USAGE
0006 %
0007 %    positions = LoadPositions(filename,rate)
0008 %
0009 %    filename            position file name
0010 %    rate                optional sampling rate (if timestamps are not
0011 %                        provided in the file)
0012 
0013 % Copyright (C) 2004-2011 by Michaƫl Zugaro
0014 %
0015 % This program is free software; you can redistribute it and/or modify
0016 % it under the terms of the GNU General Public License as published by
0017 % the Free Software Foundation; either version 3 of the License, or
0018 % (at your option) any later version.
0019 
0020 positions = [];
0021 if ~exist(filename),
0022     error(['File ''' filename ''' not found.']);
0023 end
0024 
0025 [~,~,extension] = fileparts(filename);
0026 if strcmp(extension,'.whl') || strcmp(extension,'.pos'),
0027     positions = load(filename);
0028     t = (0:length(positions)-1)'/rate;
0029     positions = [t positions];
0030 elseif strcmp(extension,'.mqa'),
0031     positions = load(filename);
0032 end
0033 
0034

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005