I am having some trouble with Matlab right now. I am currently trying to remove all the NaN's from a large Cell Array I have 3806 x 122. I have been looking at solutions from similar problems, and I came up with.

```
data(cellfun(@(x) any(isnan(x(:))), data)) = [];

```

My matrix is kind of weird because it looks like this

```
(ex).
1    2    3    4    5    5    NaN
6    5    2    5    6    7    NaN
2    3    4    5    6    7    NaN
NaN  NaN  NaN  NaN  NaN  NaN  NaN

```

My problem is when I apply the line of code above to my array I get an output of this with no NaNs.

```
1    2    3    4    5    5    6    5    2    5    6    7    2    3    4    5    6    7    etc...

```

I don't understand why it does this. I also have to be careful with deleting the columns because each column has a corresponding title, and I don't want to mix them up. It would be helpful if I could somehow index which columns and rows have the NaNs, so I could delete the corresponding the titles with them.

In the end, I want to put the titles and data into a dataset structure that looks like this.

```
(ex).
'title1'   'title2'   'title3'   'title4'   'title5'   'title6'
1          2          3          4          5          5
6          5          2          5          6          7
2          3          4          5          6          7

```

Any help is greatly appreciated.

Regards,
Jonathan