ismonotonic

버전 1.2.0.0 (2 KB) 작성자: Richie Cotton
Determines whether or not a vector or matrix is monotonically increasing or decreasing.
다운로드 수: 4.8K
업데이트 날짜: 2010/1/20

라이선스 보기

편집자 메모: This file was a File Exchange Pick of the Week

ISMONOTONIC(X) returns a boolean value indicating whether or not a vector is monotonic.
By default, ISMONOTONIC returns true for non-strictly monotonic vectors,
and both monotonic increasing and monotonic decreasing vectors. For
matrices and N-D arrays, ISMONOTONIC returns a value for each column in
X.

ISMONOTONIC(X, 1) works as above, but only returns true when X is
strictly monotonically increasing, or strictly monotonically decreasing.

ISMONOTONIC(X, 0) works as ISMONOTONIC(X).

ISMONOTONIC(X, [], 'INCREASING') works as above, but returns true only
when X is monotonically increasing.

ISMONOTONIC(X, [], 'DECREASING') works as above, but returns true only
when X is monotonically decreasing.

ISMONOTONIC(X, [], 'EITHER') works as ISMONOTONIC(X, []).

ISMONOTONIC(X, [], [], DIM) works as above, but along dimension DIM.

NOTE: Third input variable is case insensitive, and partial matching is
used, so 'd' would be recognised as 'DECREASING' etc..

EXAMPLE:
x = [1:4; 6:-2:2 3]
ismonotonic(x)
ismonotonic(x, [], 'i')
ismonotonic(x, [], [], 2)

x =
1 2 3 4
6 4 2 3
ans =
1 1 1 1
ans =
1 1 0 0
ans =
1
0

NEW FEATURES in v1.1:
Code now fully vectorised.
Support for N-D arrays.
Character arrays now allowed.

ACKNOWLEDGEMENTS:
Thanks to Jos X for advice on vectorisation

인용 양식

Richie Cotton (2024). ismonotonic (https://www.mathworks.com/matlabcentral/fileexchange/11637-ismonotonic), MATLAB Central File Exchange. 검색됨 .

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

Community Treasure Hunt

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

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

String matching updated as per Jan Simon's suggestions.
Hungarian variable names changed to more matlabby ones.

1.0.0.0