Remove a row from an array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hadley Acrh
el 6 de Nov. de 2019
Comentada: Hadley Acrh
el 7 de Nov. de 2019
I have a two sets of coordinates, and need to exclude one set from the other. Here 'grid' & 'yx' are the two lists. How would I remove all 'xy' coordinates from 'grid'?
x = [1,1,1,1,1,1,2,2,2];
y = [1,1,2,1,1,2,1,1,2];
n = 1:12;
yx = [y',x'];
[gx,gy] = meshgrid(n,n);
gxy=cat(2,gx',gy');
grid = reshape(gxy,[],2);
0 comentarios
Respuesta aceptada
the cyclist
el 6 de Nov. de 2019
I don't quite understand.
Do you mean that if a row from grid also appears as a row in yx, then that row should be removed from grid? If yes, then ...
grid(ismember(grid,yx,'row'),:) = []
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots 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!