matlab length of each element in cell array

前端 未结 2 1179
灰色年华
灰色年华 2020-12-20 16:15
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 comm

相关标签:
2条回答
  • 2020-12-20 16:23

    arrayfun - Apply function to each element of array check documentation: http://www.mathworks.com/help/techdoc/ref/arrayfun.html

    0 讨论(0)
  • 2020-12-20 16:49
    cellfun('length',a)
    

    "apply length(x) to each element x in a".

    cellfun docs.

    0 讨论(0)
提交回复
热议问题