function [sector, selectedIndices] = extractHelixAngleSector(helixAngles,startAngle,angularWidth) % helixAngle: PxL Matrix of P plots values of L length % startAngle in degrees % angularWidth in degrees [Rows,~] = size(helixAngles); startIndex = round((startAngle/360) * Rows)+1; endIndex = round((angularWidth/360) * Rows); endIndex = endIndex + startIndex; % can be more that size of Rows if endIndex <= Rows sector = helixAngles(startIndex:endIndex,:); selectedIndices = startIndex:endIndex; else sector = [helixAngles(startIndex:end,:);helixAngles(1:endIndex-Rows,:)]; selectedIndices = [startIndex:Rows,1:endIndex-Rows]; end end