필터 지우기
필터 지우기

Find the indices of a cell array containing numbers in a array

조회 수: 5 (최근 30일)
em
em 2016년 1월 13일
답변: Walter Roberson 2016년 1월 13일
I have a cell array A, containing different numbers in a cell. I also have an array B containing desired numbers. How can I find result C, the indices of the cell array, which contain numbers appeared in B. For example,
A={[1 2 3 4] [10 11 12] [99 98] [21 30] [42 43 45 56]}
B= [10 43]
C= {[] [1] [] [2]} // or C=[2 5]

답변 (1개)

Walter Roberson
Walter Roberson 2016년 1월 13일
C = find( cellfun(@(a) any(ismember(B, a)), A) )

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by