Expand|Select|Wrap|Line Numbers

- rows = dim[0];
- pagesize = dim[0]*dim[1];
- for(ix=1;ix<dim[0]-1;ix++)
- for(iy=1;iy<dim[1]-1;iy++)
- for(iz=1;iz<dim[2]-1;iz++)
- {
- index = ix + iy*rows + iz*pagesize;
- if(MASK[index]==0)
- Gradient[index]=0;
- else
- (...)
- }

dim[0] x dim[1] x dim[2] but index doesnt seem to me to iterate ovaer all elements of MASK (this can for example seen by the fact the first iteration gives index=1+rows+pagesize=1+rows*(1+dim[1]))

EDIT: to be precise MASK is imported from Matlab in the following way:

in the mexfunction there is

Expand|Select|Wrap|Line Numbers

- MASK = mxGetPr(prhs[1]);

I hope it is clear.