# matlab matrix substitution without loops

below there is a task we were asked to do using matlab. I wrote this function below which works fine. But, since 'for' loops were not shown yet in the course, I think that the instructor meant doing it without loops. Any ideas? Thanks!

By the way, How do I make new line in stackexchange editor? Thanks!

Given $m$, $n$ you can assign
$A(1:2:m,1:2:n)=1;$
$A(2:2:m,2:2:n)=1;$