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
Walter Roberson 2017년 11월 22일

0 개 추천

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
Andrei Bobrov 2017년 11월 22일
편집: Andrei Bobrov 2017년 11월 22일

0 개 추천

out = celltime(cellfun(@(x)iscell(x) & numel(x) > 1 ,celltime));
Quintin De Lima
Quintin De Lima 2017년 11월 22일
편집: Quintin De Lima 2017년 11월 22일

0 개 추천

thank you. However i managed to solve the problem immediately after i posted this.
size_t = size(cell);
idx = zeros(size_t);
for c = 1:size_t
[m,n]= size(cell{c,1});
idx(c) = n;
end
new_ind = idx >=2;
anomolies = celltime(new_idx);

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

제품

태그

질문:

2017년 11월 22일

편집:

2017년 11월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by