enumBase2

版本 1.0.0.0 (338 字节) 作者: Shawn Mikula
Constructs a character or numeric array that enumerates from 0 to (2^n - 1) in binary.
826.0 次下载
更新时间 2006/8/21

无许可证

a = enumBase2(n) constructs a cell array that enumerates from 0 to (2^n - 1) in binary.

a = enumBase2(n,outputformat) constructs an array that enumerates from 0
to (2^n - 1) in binary. The type of array output is given by
outputformat. By default, outputformat=1, which outputs a cell array.
If outputformat=2, then the output is a numeric array.

Examples
-------
numBase2(4) returns the following cell array:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

numBase2(4,2) output the same as above, except as a numeric array.

Useful for combinatorics.

引用格式

Shawn Mikula (2024). enumBase2 (https://www.mathworks.com/matlabcentral/fileexchange/12007-enumbase2), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2006a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0

update to include additional functionality and incorporate user comment to improve performance