Torus Datatype

버전 1.1.0.1 (937 KB) 작성자: Steve McClure
Safely access out-of-bounds array indices using a Torus wrapper
다운로드 수: 476
업데이트 날짜: 2016/9/1

라이선스 보기

A Torus is a geometric surface that can be represented by a doughnut: from any point on the surface, moving up/down or left/right will eventually lead you back to where you started, to continue on indefinitely. This has the capability of representing an infinite space with a finite amount of material.
The Torus datatype provides this functionality by wrapping the raw TrueData, and using (one-based) modular arithmetic to extend its space indefinitely. The subscript implementation is meant to be intuitive and match MATLAB's behavior of the builtin datatypes as closely as possible.
An easy example is the need to have the pattern [1 2 3] repeated end-over-end in a vector of length 20. A somewhat general solution might look like the following:

x = 1:3; % original data
n = 20;
y = repmat(x,1,ceil(n/length(x))); % make a new vector that is too big
y(1:n) % pick off the first n elements

Doing this with a Torus would be much more intuitive and efficient:

T = Torus(1:3);
T(1:20)

인용 양식

Steve McClure (2024). Torus Datatype (https://www.mathworks.com/matlabcentral/fileexchange/46538-torus-datatype), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2014a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Vector Fields에 대해 자세히 알아보기
태그 태그 추가
도움

줌: SpriteKit Framework

Community Treasure Hunt

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

Start Hunting!

example/html/

버전 게시됨 릴리스 정보
1.1.0.1

Updated license

1.1.0.0

Changing Title/Summary on initial submission