# matlab determine if cells array is a row

I have a data:

```data =

{1x6 cell}    {1x6 cell}
```

I want to know if data{2:end} is a row, so I used:

```stop = 0;
for (k=2:length(data))
if isrow(data{k})
stop = 1;
end
end
```

but, the function 'isrow' doesn't work for arguments of type 'cell'.

```structArray = cell2struct(cellArray, fields, dim);
```

but I don't think that I will be able to use that, because I have to give 'fields' and 'dim' to this function.

I don't really see what the problem is here. This is what I get on R2010b:

```>> data = {cell(1,6) cell(1,6) cell(3,6)}
data =
{1x6 cell}    {1x6 cell}    {3x6 cell}

>> isrow(data{2})
ans =
1

>> isrow(data{3})
ans =
0
```

Try to check it in another way:

```  function bIsRow = isrow(x)
bIsRow = (size(x,2) == numel(x));
end
```

Try

```if isrow(cell2mat(data{k}))
```

You can use the following code for isrow()

```function Y = isrow(X)
%
% ISROW    True for row vectors.
%
%   Y = ISROW(X) returns logical 1 if X is a row vector, 0 otherwise.
%   ISROW returns 1 for scalars also.
%
%

if ndims(X)==2 & size(X,1)==1 & size(X,2)>=1
Y = logical(1);
else
Y = logical(0);
end
```

Source via MATLAB Central