corresponding elements of a setdiff of another variable
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Bharat
el 14 de Jul. de 2015
Editada: Andrei Bobrov
el 14 de Jul. de 2015
Hello, I have a question about setdiff. I have three variables X ,Y, p. I need to find elements of Y excluding elements of p and corresponding elements of X (corresponding to Y). I ran the following (Both X and Y have same number of elements).
y=setdiff(Y,p);
x= X(setdiff(Y,p)); this doesn't work. Any solutions?
Thanks,
Bharat
0 comentarios
Respuesta aceptada
Andrei Bobrov
el 14 de Jul. de 2015
Editada: Andrei Bobrov
el 14 de Jul. de 2015
x = X(~ismember(Y,p));
or
[~,ii] = setdiff(Y,p);
x = X(ii);
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!