Can someone help me understand how this loop works?
Mostrar comentarios más antiguos
n=4;
A = ones(n);
for i= 1:n
for j= 1:n
if (i>2) && (j>2)
A(i,j) = A(i-1,j) + A(i,j-1);
elseif (i<3) && (j<3)
A(i,j) = A(i+1,j) + A(i,j+1);
end
end
end
A
1 comentario
Ruslan Khoguev
el 23 de Nov. de 2015
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!