Question: Nested for loop with mod input

Hi 

I am a Matlab user and just started using maple because I need more precision for my calculations. I failed to make Matlab interface work, therefore, I am writing my codes from the begining. And I am having a problem with a nested for loop.

The thing that I am trying to make is (in Matlab)

for j=1:N;
for i=mod(j-1,2):2:j;
D(i+1,j+1)=2*j;
end
end
 
In maple I tried something like
  for i from 1 to N do  
f:= (i-1) mod 2 
 for j from f by 2 to N do 
 Dhat[i+1,j+1]=2*j  
end do  
 end do
 
But it is not working. Where is my mistake? 
 
Thank you for the help
 
Erdem
Please Wait...