Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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 visualización (últimos 30 días)
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

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by