How to find an array within a cell array
古いコメントを表示
I have a 5000x1 cell. I'm trying to find the cells that contain arrays.
below is an example of the rows in the cell, I'm trying to identify rows similar to row 651. As i wish to extract only these rows from the table

回答 (3 件)
Walter Roberson
2017 年 11 月 22 日
cellfun(@iscell, YourCellArray)
is one possible interpretation. But remember that 'Peter ' is an array in MATLAB, so another interpretation would be
cellfun(@(C) length(C) > 1, YourCellArray)
To double check: is it correct that you would want to detect 'Peter ' because that is an array (a character vector), but that you would not want to detect "Peter " because MATLAB considers that a 1 x 1 string() object ?
Andrei Bobrov
2017 年 11 月 22 日
編集済み: Andrei Bobrov
2017 年 11 月 22 日
out = celltime(cellfun(@(x)iscell(x) & numel(x) > 1 ,celltime));
Quintin De Lima
2017 年 11 月 22 日
編集済み: Quintin De Lima
2017 年 11 月 22 日
カテゴリ
ヘルプ センター および File Exchange で Cell Arrays についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!