Effacer les filtres
Effacer les filtres

Comparing Two Matrices and Returning Differences...

7 vues (au cours des 30 derniers jours)
Michelle De Luna
Michelle De Luna le 17 Avr 2020
Hi friends!
I hope this post finds you all in good health! I'm reaching out because I had a question regarding the comparison of two matrices with geographic coordinates. I have matrix A (which has latitude, longitude, and frequency) as well as matrix B (which also has latitude, longitude, and frequency). I'm trying to build a third matrix - matrix C - where I have the differences of matrix A and matrix B, i.e. the latitude/longitude/frequency that were in matrix B but did not initally appear in matrix A. However, if there was a value that appeared in both matrix A AND matrix B, but the value of "frequency" was different (e.g. frequency for matrix A was 3 and for matrix B was 7), I would also like to be able to keep the latitude and longitude of this data point, but have the difference in value be represented in the new matrix. Is there anyway to do this for large matrices? Any help would be greatly appreciated. :)
M.
  1 commentaire
David Hill
David Hill le 17 Avr 2020
An example of your data would be helpful. What have your tried?

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 17 Avr 2020
Get a combined set of all coordinates:
lat = [A(:, 1); B(:, 1)];
lon = [A(:, 2); B(:, 2)];
xy = unique([lat, lon], 'rows');
latBoth = xy(:, 1);
longBoth = xy(:, 2);
Now use the original lat, lon, and frequencies in scatteredInterpolant() to get the values at the locations that were not present in the one array but were present in the other one by passing in latBoth and longBoth. I'm attaching a scatteredInterpolant demo to help you with that part.
Once you have an array where both A and B have estimates for all locations, you can subtract the arrays to find your frequency differences.
  1 commentaire
Michelle De Luna
Michelle De Luna le 17 Avr 2020
Thank you very much! I appreciate the help. :)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by