daylanKifky I'm not entirely sure, that's why I think it is a feature in matlab.
Here is a method from TimeSeriesDataBaseClass -- this is when the time array is created:
methods
function obj = set.SampleRate(obj, sampleRate)
obj.SampleRate = sampleRate;
if(obj.SampleRate == 0)
obj.Time = [];
obj.TimeAxis = 'Sample';
elseif(obj.NumPackets ~= 0)
obj.Time = (0:obj.NumPackets-1)' * (1/obj.SampleRate) + obj.StartTime;
obj.TimeAxis = 'Time (s)';
end
end
function obj = set.StartTime(obj, startTime)
obj.StartTime = startTime;
obj.SampleRate = obj.SampleRate;
end
function samplePeriod = get.SamplePeriod(obj)
if(obj.SampleRate == 0)
samplePeriod = 0;
else
samplePeriod = 1 / obj.SampleRate;
end
end
end
Here's from InertialAndMagneticDataBaseClass:
methods (Access = protected)
function obj = Import(obj, fileNamePrefix)
data = obj.ImportCSVnumeric(fileNamePrefix);
obj.Gyroscope.X = data(:,2);
obj.Gyroscope.Y = data(:,3);
obj.Gyroscope.Z = data(:,4);
obj.Accelerometer.X = data(:,5);
obj.Accelerometer.Y = data(:,6);
obj.Accelerometer.Z = data(:,7);
obj.Magnetometer.X = data(:,8);
obj.Magnetometer.Y = data(:,9);
obj.Magnetometer.Z = data(:,10);
obj.SampleRate = obj.SampleRate; % call set method to create time vector
end
end
The data is imported, then obj.SampleRate creates the time vector -- but I do not see anywhere the calculating of the gyro/acc/mag arrays into the new time vector. (?)