Code covered by the BSD License  

Highlights from
NTRUE

Be the first to rate this file! 2 Downloads (last 30 days) File Size: 1.73 KB File ID: #10924

NTRUE

by Jos (10584)

 

30 Apr 2006 (Updated 15 Sep 2006)

Logical array with a specific number of true values

| Watch this File

File Information
Description

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)

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
15 Sep 2006

(sep 2006)
- algorithm after all checks
- replaced call to randperm by a direct call to sort

Tag Activity for this File
Tag Applied By Date/Time
matrices Jos (10584) 22 Oct 2008 08:24:02
random Jos (10584) 24 Oct 2008 15:34:15
true Jos (10584) 24 Oct 2008 15:34:15
false Jos (10584) 24 Oct 2008 15:34:15
logical Jos (10584) 24 Oct 2008 15:34:15
rand Jos (10584) 24 Oct 2008 15:34:15
utility Jos (10584) 24 Oct 2008 15:34:15
easy Jos (10584) 24 Oct 2008 15:34:15
tool Jos (10584) 24 Oct 2008 15:34:15
create Jos (10584) 24 Oct 2008 15:34:15

Contact us at files@mathworks.com