I have 5 vectors y1, y2, y3, y4, y5 of variable number of samples or values. I have created a cell array as:

`vectorarray = {y1, y2, y3, y4, y5}`

I know the classic way of finding the largest number of samples in the elements of the cell array can be done as follows:

`maxsamples = 0for k = 1:numel(vectorarray) currveclength = length(vectorarray{k}) if currveclength > maxsamples maxsamples = currveclength endend`

Is there a simpler way to do it in a single line in Matlab?

## Best Answer