how to generate a random binary matrix with a specific condition?

1 次查看(过去 30 天)
if matrix A shows the number of group of ones in G (n,m) matrix like that
G = [ 1 1 0 0 1
0 1 1 1 0
1 0 1 1 1 ]
SO the A matrix will be
A = [ 2 1
3 0
1 3 ]
Then i want to generate (n,m) random matrix which the ones in this Matrix depend on A in the same order they appear
one solution will be
x = [ 0 1 1 0 1
0 0 1 1 1
1 0 1 1 1 ]
another solution
x = [ 1 1 0 1 0
1 1 1 0 0
1 0 1 1 1 ]

回答(1 个)

Walter Roberson
Walter Roberson 2016-5-5

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by