a={'a','aa','aaa','aaaa'}
length(a)
  4
size(a)
  1 4
How can I get the length of each element in the cell array with a single command? The desired output in the above example would be [1 2 3 4].
cellfun('length',a)
"apply length(x) to each element x in a".
cellfun docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With