Effacer les filtres
Effacer les filtres

Cut out piece of matrix based upon other matrix

1 vue (au cours des 30 derniers jours)
yoni verhaegen
yoni verhaegen le 23 Mar 2017
Modifié(e) : Jan le 23 Mar 2017
Hi,
I have a DEM of an area represented by an array 46592x3 (first colom: X-coordinate, second colom: Y-coordinate, third colom: elevation). Next to that, I have a 11155x3 matrix (first colom: X-coordinate, second colom: Y-coordinate, third colom: 0 of no glacier present and 1 if glacier present). The extent of the second matrix lays completely within the first matrix.
I now want to cut out that part of the DEM (first array) where only the glacier is present (value 1 in the second array).
Can someone help me?
Thanks!

Réponses (1)

Jan
Jan le 23 Mar 2017
Modifié(e) : Jan le 23 Mar 2017
glacierPos = B(B(:, 3) == 1, 1:2); % Coordinates of glacier
inGlacier = ismember(DEM(:, 1:2), glacierPos, 'rows');
Wanted = DEM(inGlacier, :);

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by