1 function symb = bits2symb(bits,M,bitorder)
4 error('Bits must be of type logical.');
7 if nargin<2 || isempty(M) % if M not specified, or is an empty matrix
8 log2M_ = size(bits,1); % log2(M) is equal to first dimension of bits matrix
10 log2M_ = log2M(M); % log2(M) is computed from M
12 if all(size(bits)>1) &&
N~=log2M_ %% if given a matrix whose first dimension disagrees with log2(M) of given M
13 error('First dimension of input bit matrix (%d) does not agree with log2(M) (%d).',
N,log2M_);
15 bits = reshape(bits,log2M_,[]);
19 bitorder = 'lsb-first'; % if bitorder not specified, assume LSB is first
21 mult = 2.^(0:log2M_-1)'; % multipliers for LSB
22 if strcmpi(bitorder,'msb-first') % if order is MSB, flip multipliers
24 elseif ~strcmpi(bitorder,'lsb-first')
25 % If order is not 'lsb-first' at this point, bitorder is neither of two
26 % available options => throw an error.
27 error('Bit order can be
set to ''lsb-first'' (default) or ''msb-first''.');
30 symb = uint16(sum(bsxfun(@times,bits,mult),1)')+1;
function N(in obj)
Retrieve the number of signal components.
function set(in obj, in varargin)
Set properties for the current object.
function end(in obj, in k, in n)
Overload of indexing end statement.