# How to compare values between two NxM matrices

3 vues (au cours des 30 derniers jours)
Christopher le 18 Juin 2024
Commenté : Christopher le 18 Juin 2024
Hello everyone!
I'm still pretty new to MatLab, and am getting familiar with how to operate it, so I am looking for some ideas as to how to best tackle this problem. It seems like a FOR loop to compare the minimums would be the best way to tackle this, but I'm not sure.
I have two matrixes that I need to examine for a discrepancy between expected altitude and measured altitude. I need to compare a matrix of DEM data (1x1920) against a matrix of retrieved altitudes (820x1920). I need to index the columns where there the altitude plots below the DEM, and examine the difference between the two matrices.
The example below provides an outline of the problem. The white line represents recorded DEM data, and the curtain represents the data I need to examine to determine if there was an error with the recorded altitude. For example, the DEM data below, idx(1,563) shows .5767, and the altitude at that same point shows idx(773,563) shows a value of 1.0735. So there is no numerical correlation between the value of the DEM and the value of the altitude (since it seems more akin to a bar graph).
Any help getting started with this would be much appreciated!
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
Umar le 18 Juin 2024
You can adapt this code snippet to your specific data and further analyze the identified columns to understand the discrepancies between the altitude and DEM data. This should help you get started on tackling the problem efficiently in Matlab.
Christopher le 18 Juin 2024
Thank you for providing the basis for a loop! I adapted it, and it reported that every column had a difference, so I'll have to make sure I look at indexing the end of the altitude data and comparing against the appropriately indexed DEM data.

Connectez-vous pour commenter.

### Réponse acceptée

Voss le 18 Juin 2024
discrepancy_columns = find(any(altitude_data<DEM_data,1));
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Christopher le 18 Juin 2024
Thank you for providing a starting point! I'll make sure I adapt this code so that it loops through the matrices and finds areas where there is a discrepancy.

Connectez-vous pour commenter.

R2024a

### Community Treasure Hunt

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

Start Hunting!

Translated by