sw-plotting-tool/timeAxisWithIncrement.m
2022-12-30 22:44:46 +01:00

24 lines
648 B
Matlab

function [timeAxis, yData] = timeAxisWithIncrement(data, increment, beginning, ending, channel)
if ending ~= 0
timeAxis = 0:increment:ending;
else
timeAxis(1) = increment;
for i = 2:height(data)
timeAxis(i) = increment + timeAxis(i-1);
end
end
yData = data(:, channel);
yData = yData(1:length(timeAxis));
if beginning ~= 0
tempTimeArray = beginning:increment:timeAxis(end);
startIndex = length(timeAxis) - length(tempTimeArray);
yData = yData(startIndex+1:startIndex+length(tempTimeArray));
timeAxis = tempTimeArray;
end
end