Cell rows/columns size

4 views (last 30 days)
Memo Remo
Memo Remo on 20 May 2020
Commented: Memo Remo on 20 May 2020
Hi,
I have a m by n cell in which some rows has less than 10 strings and the remaining elements are empty ([ ]). I now want to determine how many strings are there in each rows. If this cell was an array I could use "nonzeros(A(i,:))" to determine this but I don't know how to do this for a cell. Please help me fix this problem.
Thanks.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 20 May 2020
c={'12',[],'adjk';'jkjf','j;',[]}
b=cellfun(@isempty,c)
  1 Comment
Memo Remo
Memo Remo on 20 May 2020
Hi Fangjun,
Thanks for your help. This works.
Best,
M

Sign in to comment.

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!