# How to convert Cartesian Index array into a Boolean array?

**URL:** <https://discourse.julialang.org/t/how-to-convert-cartesian-index-array-into-a-boolean-array/71465>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 14, 2021, 8:54pm UTC](https://discourse.julialang.org/t/how-to-convert-cartesian-index-array-into-a-boolean-array/71465 "2021-11-14T20:54:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [November 14, 2021, 8:54pm UTC](https://discourse.julialang.org/t/how-to-convert-cartesian-index-array-into-a-boolean-array/71465/1 "2021-11-14T20:54:55Z")

</div>

I have a Cartesian index array like the below:  
`Ind = CartesianIndex{2}[CartesianIndex(1, 1), CartesianIndex(2, 1), CartesianIndex(3, 1), ...];`

I have an array `A` with the same number of rows and 35 columns. I want to only extract the rows out of A with the Cartesian Index being 1, using a command like the below:  
`B = A[Ind, :];`

Unfortunately, I can’t do that with an CartesianIndex. Otherwise, my array will become a n x 1 array, instead of the expected n x 35 array.

I wonder if anyone could show me how to convert my Cartesian index array into a regular Boolean array, so that I can do the above. Many thanks!

---

<div class="post-metadata">

**Author:** ![leon](https://avatars.discourse-cdn.com/v4/letter/l/dc4da7/32.png) [@leon](https://discourse.julialang.org/u/leon)\
**Post date:** [November 15, 2021, 5:39pm UTC](https://discourse.julialang.org/t/how-to-convert-cartesian-index-array-into-a-boolean-array/71465/3 "2021-11-15T17:39:06Z")

</div>

This seems to be another 1-column matrix vs vector issue.

After I convert my data to vector first before generating the Cartesian index, it is working as expected now.
