UNINIT - Create an uninitialized variable (like ZEROS but faster)

버전 1.0.0.0 (7.24 KB) 작성자: James Tursa
UNINIT is similar to ZEROS, except UNINIT returns uninitialized values instead of zero values.
다운로드 수: 1.1K
업데이트 날짜: 2011/5/9

라이선스 보기

UNINIT is very similar to the ZEROS function, except that UNINIT returns an uninitialized array instead of a zero-filled array. Thus, UNINIT is faster than the ZEROS function for large size arrays. Since the return variable is uninitialized, the user must take care to assign values to the elements before using them. UNINIT is useful for preallocation of an array where you know the elements will be assigned values before using them.

Syntax (nearly identical to the ZEROS function)

B = uninit
B = uninit(n)
B = uninit(m,n)
B = uninit([m n])
B = uninit(m,n,p,...)
B = uninit([m n p ...])
B = uninit(size(A))
B = uninit(m, n,...,classname)
B = uninit([m,n,...],classname)
B = uninit(m, n,...,complexity)
B = uninit([m,n,...],complexity)
B = uninit(m, n,...,classname,complexity)
B = uninit([m,n,...],classname,complexity)

Description

B = uninit
Returns a 1-by-1 scalar uninitialized value.

B = uninit(n)
Returns an n-by-n matrix of uninitialized values. An error message
appears if n is not a scalar.

B = uninit(m,n) or B = uninit([m n])
Returns an m-by-n matrix of uninitialized values.

B = uninit(m,n,p,...) or B = uninit([m n p ...])
Returns an m-by-n-by-p-by-... array of uninitialized values. The
size inputs m, n, p, ... should be nonnegative integers. Negative
integers are treated as 0.

B = uninit(size(A))
Returns an array the same size as A consisting of all uninitialized
values.

If any of the numeric size inputs are empty, they are taken to be 0.

The optional classname argument can be used with any of the above.
classname is a string specifying the data type of the output.
classname can have the following values:
'double', 'single', 'int8', 'uint8', 'int16', 'uint16',
'int32', 'uint32', 'int64', 'uint64', 'logical', or 'char'.
(Note: 'logical' and 'char' are not allowed in the ZEROS function)
The default classname is 'double'.

The optional complexity argument can be used with any of the above.
complexity can be 'real' or 'complex', except that 'logical' and 'char'
outputs cannot be complex. (this option not allowed in the ZEROS function)
The default complexity is 'real'.

UNINIT is typically self building. That is, the first time you call UNINIT, the uninit.m file recognizes that the mex routine needs to be compiled and then the compilation will happen automatically. UNINIT uses the undocumented MATLAB API function mxCreateUninitNumericMatrix. It has been tested in PC WinXP versions R2006b through R2011a, but may not work in future versions or non-PC versions of MATLAB.

인용 양식

James Tursa (2025). UNINIT - Create an uninitialized variable (like ZEROS but faster) (https://www.mathworks.com/matlabcentral/fileexchange/31362-uninit-create-an-uninitialized-variable-like-zeros-but-faster), MATLAB Central File Exchange. 검색 날짜: .

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

Community Treasure Hunt

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

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