Zero-Based Indexable Arrays (OOP Exercise)

버전 1.0.0.0 (3.94 KB) 작성자: Matt J
Creates arrays whose indexing starts from zero instead of one.
다운로드 수: 392
업데이트 날짜: 2011/10/16

라이선스 보기

I created this class of zero-indexable arrays purely as a fun OOP exercise, in reaction to various Newsgroup threads inquiring about zero-indexable matrix types for MATLAB. Even though I've gone to the trouble to overload many methods for the class, I offer it as a toy, nothing more, and strongly urge you not to use it for anything serious.

USAGE:

A=ZeroBased(B)

where B is a normal MATLAB matrix will cast B to A, which is exactly
the same, except that it is 0-based indexed instead of 1-based.


EXAMPLE 1:

>>A=ZeroBased(rand(3))

A =

0.7922 0.0357 0.6787
0.9595 0.8491 0.7577
0.6557 0.9340 0.7431

>>A(0,2)

ans =

0.6787

EXAMPLE 2:

It works for sparse matrices to, and will even display at the command line
with zero-based indexing display syntax, e.g.,

>> A=ZeroBased(speye(3))

A =

(0,0) 1
(1,1) 1
(2,2) 1

인용 양식

Matt J (2024). Zero-Based Indexable Arrays (OOP Exercise) (https://www.mathworks.com/matlabcentral/fileexchange/33301-zero-based-indexable-arrays-oop-exercise), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0