NTRUE - Logical array with a specific number of true values
NTRUE(N,P,Q, ...) or NTRUE(N,[P Q ...]) creates a logical array of size
[P Q ...] with N randomly positioned true values. NTRUE(N,P) is short for
NTRUE(N,P,P). All arguments (N,P,Q,...) are positive scalars.
NTRUE(N) creates a N-ny-N matrix with N true values.
Example:
NTRUE(5,3,4) % creates a 3-by-4 matrix with 5 true (and 7 false)
values, for instance:
% 0 0 0 0
% 1 1 0 0
% 1 0 1 1
See also TRUE, FALSE, ONES, ZEROS,
and SLM, SHAKE, NONES (on the MatLab FEX)
인용 양식
Jos (10584) (2024). NTRUE (https://www.mathworks.com/matlabcentral/fileexchange/10924-ntrue), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
- MATLAB > Language Fundamentals > Operators and Elementary Operations > Logical (Boolean) Operations >
태그
도움
줌: randone1
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0.0 | (sep 2006)
|