Search code examples
matlabcell-array

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'.

I read about it, and there is a function: 'cell2struct':

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.


Solution

  • 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