function iHelix=snailMatIndex(inMatDims)
if length(inMatDims)==1
inMatDims=repmat(inMatDims, 1, 2);
end
nElemems=inMatDims(1)*inMatDims(2);
indMat =reshape(1:nElemems, inMatDims);
iHelix=[];
while ~isempty(indMat)
if size(indMat, 2)==1
iHelix=cat( 2, iHelix, transpose(indMat(:, 1)) );
indMat=[];
else
iHelix=cat( 2, iHelix, indMat(1, :) );
indMat(1, :)=[]; % remove the current top row
if ~isempty(indMat)
indMat=rot90(indMat); % rotate index matrix 90° clock-
wise
end % if ~isempty(indMat)
end % if size(indMat, 2)==1
end % while ~isempty(indMat)

댓글 수: 1

Walter Roberson
Walter Roberson 2019년 4월 13일
Helix scan, I think.
Read the documentation that was provided with the code. If there wasn't any, then ask the author to document the code.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

2019년 4월 13일

댓글:

2019년 4월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by