Remove a row from an array
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hadley Acrh
am 6 Nov. 2019
Kommentiert: Hadley Acrh
am 7 Nov. 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 Kommentare
Akzeptierte Antwort
the cyclist
am 6 Nov. 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'),:) = []
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!