Hi guys,
I have a cell array(let's say c) consisting of 2D arrays and I want to find all the arrays that(say a is an array) have size(a,1)<5 and throw them away of the cell. How can I do that?
Thanks in advance

 채택된 답변

James Tursa
James Tursa 2017년 1월 16일
편집: James Tursa 2017년 1월 16일

1 개 추천

c = your cell array
x = cellfun(@(x)size(x,1)<5,c); % Logical indexes of arrays with 1st dim < 5
c(x) = []; % Delete those elements from the cell array

추가 답변 (1개)

Stephen23
Stephen23 2017년 1월 16일
편집: Stephen23 2017년 1월 16일

0 개 추천

Faster and simpler than using a function handle:
idx = cellfun('size',c,1)<5;
c(~idx)

카테고리

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

질문:

2017년 1월 16일

편집:

2017년 1월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by