function [cycles, numCycles] = getCycles(data, cycleType, dataIndex)

if(cycleType == "temp")
    tempSteps = diff(data{dataIndex}.SetTemp);
    stepIndexes = find((tempSteps>1) | (tempSteps<-1));
else
    pressureSteps = diff(data{dataIndex}.SetPressure);
    stepIndexes = find((pressureSteps>1) | (pressureSteps<-1));
end


startIndex = 1;
for i=1:length(stepIndexes)
    cycle{i}.dt = data{dataIndex}.dtLV(startIndex:stepIndexes(i)-1);
    cycle{i}.pressureDBar = data{dataIndex}.pressureDBar(startIndex:stepIndexes(i)-1);
    cycle{i}.vrsVolts = data{dataIndex}.vrsVolts (startIndex:stepIndexes(i)-1);
    cycle{i}.vrsStdDev = data{dataIndex}.vrsStdDev(startIndex:stepIndexes(i)-1);
    cycle{i}.thermTemp = data{dataIndex}.thermTemp(startIndex:stepIndexes(i)-1);
    cycle{i}.vkVolts = data{dataIndex}.vkVolts(startIndex:stepIndexes(i)-1);
    cycle{i}.vkStdDev = data{dataIndex}.vkStdDev(startIndex:stepIndexes(i)-1);
    cycle{i}.ikAmps = data{dataIndex}.ikAmps(startIndex:stepIndexes(i)-1);
    cycle{i}.ibAmps = data{dataIndex}.ibAmps(startIndex:stepIndexes(i)-1);

    startIndex = stepIndexes(i);    
end

cycles = cycle;
numCycles = length(stepIndexes);

end