# Mismatching Cell Num for Subarray

**URL:** <https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22>\
**Category:** Uncategorized\
**Created:** [October 17, 2018, 1:43am UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22 "2018-10-17T01:43:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![crstrong](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@crstrong](https://forum.tiledb.com/u/crstrong)\
**Post date:** [October 17, 2018, 1:43am UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22/1 "2018-10-17T01:43:43Z")

</div>

Hey all,

I am running into an issue where if I’m trying to write a subarray using the C++ API, it’s telling me that the number of expected cells is not equal to the actual number of cells. The trick is that I’m only trying to read the first 5 values in the array, so my subarray looks like this:

```
  std::vector<uint64_t> subarray = {0, 0, 0, 4};

```

Am I running into issues because I’m only accessing the 0th row? The rest of my query looks like this:

```
tiledb::Query md_write(_ctx, array, TILEDB_WRITE);
md_write.set_subarray(subarray);
md_write.set_layout(TILEDB_ROW_MAJOR);
md_write.set_buffer("data", img_values);

```

where img\_values is a vector of 5 values.

Thanks!

---

<div class="post-metadata">

**Author:** ![tyler](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tyler](https://forum.tiledb.com/u/tyler)\
**Post date:** [October 17, 2018, 2:01am UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22/2 "2018-10-17T02:01:58Z")

</div>

Hi Christina,

Is `data` the only attribute in your array? When writing in TileDB, you must provide values for all attributes.

Tyler

---

<div class="post-metadata">

**Author:** ![crstrong](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@crstrong](https://forum.tiledb.com/u/crstrong)\
**Post date:** [October 17, 2018, 5:46pm UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22/3 "2018-10-17T17:46:46Z")

</div>

Yes, I only have one attribute.

I should probably also mention I’m on v1.3.1 right now

---

<div class="post-metadata">

**Author:** ![crstrong](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@crstrong](https://forum.tiledb.com/u/crstrong)\
**Post date:** [October 17, 2018, 6:16pm UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22/4 "2018-10-17T18:16:38Z")

</div>

Ah, I found my issue. I had the number of values per cell reversed (not entirely sure how I managed that, but at least I found it!)

Thank you!

---

<div class="post-metadata">

**Author:** ![tyler](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tyler](https://forum.tiledb.com/u/tyler)\
**Post date:** [October 17, 2018, 11:42pm UTC](https://forum.tiledb.com/t/mismatching-cell-num-for-subarray/22/5 "2018-10-17T23:42:31Z")

</div>

Great, glad you found it!
