필터 지우기
필터 지우기

How to remove the rows with particular value in a cell?

조회 수: 1 (최근 30일)
Akhil  Reddy
Akhil Reddy 2016년 6월 7일
댓글: Jos (10584) 2017년 4월 20일
A = { a 99 8.5; b 2.4 9.7; c 12 99; d 13 11; e 1 1; f 0 1}
I would like to remove the rows with 0 and 99. i.e Row 1, Row 3 and Row 6

채택된 답변

Jos (10584)
Jos (10584) 2016년 6월 7일
a = 'unknown', b = [], c = 1, d= 1:10, e ={'cell_in_cell'}, f.x = 'struct'
A = { a 99 8.5; b 2.4 9.7; c 12 99; d 13 11; e 1 1; f 0 1}
B = A(~any(cellfun(@(x) isequal(x,0) || isequal(x,99),A,'un',1),2),:)
  댓글 수: 2
JFz
JFz 2017년 4월 6일
Hi, Jos,
Thanks for the answer here. But what is the use of 'un' and 1 here in this line: B = A(~any(cellfun(@(x) isequal(x,0) isequal(x,99),A,'un',1),2),:) Thanks!
Jos (10584)
Jos (10584) 2017년 4월 20일
"un" is short for "UniformOutput" (see the help of cellfun for details). Matlab often allows for shortening inputs.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by