MATLAB: How to calculate the cell arrays length

cell arraysMATLAB

Hi, I have this kind of cell array. As you can see in row 16, from the 7th column all the value are equal to []. it means that this row has a different lenght than the others, that are longer. Do you know how to calculate the length of the rows? And how to access to the first number of the cells (for instance in [0,1,1] I would get 0)? Thanks in advance!

Best Answer

This calculates the number of elements in each row
n = sum(~cellfun(@isempty, Obs_Val), 2)
You can calculate first element of a cell like this
Obs_Val{2, 4}(1) % cell in 2nd row, 4th column