%IJK2N Convert spatial indexes to its deposition time index n % % Examples: % n = ijn2n(3,4,5) % % Define the global variables nl nw nh before calling this function! % Copyright (C) Jie Zhang (ORCID: 0000-0002-8023-8144) 2019 function n = ijk2n(i,j,k) global nl nw nh if isequal(mod(j,2),0) n = nl + 1 - i + nl*(j-1) + nl * nw * (k-1); else n = i + nl*(j-1) + nl*nw*(k-1); end