Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
em
em el 13 de En. de 2016
Respondida: Walter Roberson el 13 de En. de 2016
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]

Respuestas (1)

Walter Roberson
Walter Roberson el 13 de En. de 2016
C = find( cellfun(@(a) any(ismember(B, a)), A) )

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by