In a cell array, how I can count the number of cells in each column?

21 ビュー (過去 30 日間)
Fercho_Sala
Fercho_Sala 2021 年 5 月 27 日
コメント済み: Fercho_Sala 2021 年 5 月 28 日
Hello, I’m doing a statistical analysis however gotte deal with these kinds of arrays. The idea is to get a vector with the number of cells in each column of the cell array (attached). Thanks.

採用された回答

Matt J
Matt J 2021 年 5 月 27 日
cellfun('length',locs)
  6 件のコメント
Fercho_Sala
Fercho_Sala 2021 年 5 月 28 日
@Matt J it works good because previously you created locs{1}, locs{2} etc… but the attached file is just a cell array , once I use this : array2table(cell2mat(locs(:))) it shows all the values in just one column, however if you notice in the cell array there are just 24 columns, with different rows, (every cell has a different number), it cannot be all in just one column. Thanks for your help.
Fercho_Sala
Fercho_Sala 2021 年 5 月 28 日
@Matt J For example, Using writecell(locs’,filename,’sheet’,1) works so good, but the matter is that this function is only to create a .xls file, and I need this in at least .mat extension.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by