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 日間)
Junaid Khan
Junaid Khan 2016 年 11 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by