Info
此问题已关闭。 请重新打开它进行编辑或回答。
As value of a decrease , M is computed in for loop and G2 is generated having rows equal to M, than i want to copy G1 rows portion equal to size of M to G2 in each iteration of for loop from maximum row to minimum,
1 次查看(过去 30 天)
显示 更早的评论
G1 = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1;
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1;
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1;
0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1;
0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1;
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1;
0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1;
0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1;
0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1;
0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1;
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1];
m=4;
r=4;
k=0;
n=2^m;
for i=1:r
k= k+factorial(m)/(factorial(m-i)*factorial(i));
end
for a=r:-1:2
M=factorial(m)/(factorial(m-a)*factorial(a));
G2 = zeros(M,n);
for o=M:1:1
G2(o,:) = G1(k,:);
k=k-1;
end
end
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!