# PSA: replacement of ind2sub/sub2ind in Julia 0.7+

**URL:** <https://discourse.julialang.org/t/psa-replacement-of-ind2sub-sub2ind-in-julia-0-7/14666>\
**Category:** General Usage\
**Tags:** indexing\
**Created:** [September 7, 2018, 3:19pm UTC](https://discourse.julialang.org/t/psa-replacement-of-ind2sub-sub2ind-in-julia-0-7/14666 "2018-09-07T15:19:07Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [September 7, 2018, 6:06pm UTC](https://discourse.julialang.org/t/psa-replacement-of-ind2sub-sub2ind-in-julia-0-7/14666/6 "2018-09-07T18:06:07Z")

</div>

Slightly off topic: How would one now write the `boxcar3` example in your blog post [Multidimensional algorithms and iteration](https://julialang.org/blog/2016/02/iteration)? Over in slack it was suggested by Simon Schoelly to replace  
`for J in CartesianRange(max(I1, I-I1), min(Iend, I+I1))` with  
`for J in CartesianIndices(UnitRange.( max(I1, I-I1).I , min(Iend, I+I1).I ))`. Works but seems a bit ugly, maybe there is a better way?

(Also, maybe that blog post could/should be updated to 1.0 as it is linked from the docs?)

---

_[View the full topic](https://discourse.julialang.org/t/psa-replacement-of-ind2sub-sub2ind-in-julia-0-7/14666)._
