필터 지우기
필터 지우기

omitting data from a cell array

조회 수: 4 (최근 30일)
shobhit mehrotra
shobhit mehrotra 2015년 4월 14일
댓글: shobhit mehrotra 2015년 4월 14일
I have a cell array
A = cell 1: 1,2,5,6 (4x1)
cell 2: 3, 5.5, 6.4, 3, 7.2 (5x1)
cell 3: 2, 13 (2x1)
cell 4: 15 (1x1)
cell 5: 2, 3.25, 6.35 (3x1)
I want to get rid of any cell that has under 3 elements, so the new cell array should have only cells 1,2,5
Thanks

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 4월 14일
n={ [1 2 5 6] ,[3 5.5 6.4 3 7.2] ,[2 13] ,15, [2 3.25 6.35] }
out=n(cellfun(@numel,n)>=3)
  댓글 수: 1
shobhit mehrotra
shobhit mehrotra 2015년 4월 14일
Thank You! What if I want to merge any cell with under 3 elements to the cell following it. For example merge cell 3 into cell 4, so the new cell 3 consists of 2,13,15 (3x1)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by