Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

spliting a vector based on another vector

1 visualización (últimos 30 días)
John Kim
John Kim el 10 de Nov. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Dear all, I have two vectors, A and B. I want to split A into two vectors, C1 and C2, where C1 contains elements of A that are also in B and C2 contains elements of A that are NOT in B. Clearly, I can do C1 = intersect(A,B); C2 = setdiff(A,C1); but it looks cumbersome. Is there a one liner, something like [C1,C2] = f(A,B)? I'd much appreciate any and all help. Thanks so much! Best, John

Respuestas (1)

Matt J
Matt J el 10 de Nov. de 2016
Editada: Matt J el 10 de Nov. de 2016
Is there a one liner, something like [C1,C2] = f(A,B)?
There will be once you write such a function f(), which you can easily do!

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by