Constuctiing special array (like binary)
显示 更早的评论
Hi, I'am new to matlab and I want to make an nxn matrix containing as first row zeros and as last row ones. The other rows should be like binary digits.
Example with n=4:
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
Thank you!!
2 个评论
Matt J
2013-12-4
The matrix you've shown is not nxn. It is 2^n x n.
Dimitris Sideratos
2013-12-5
采纳的回答
更多回答(3 个)
Dimitris Sideratos
2014-1-19
0 个投票
Jos (10584)
2014-1-20
编辑:Jos (10584)
2014-1-20
Take a look at COMBN:
USe like this:
N = 2 ; M = 3 ;
combn(0:M-1,N)
类别
在 帮助中心 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!