Info
This question is closed. Reopen it to edit or answer.
finding uncommon data in arrays
1 view (last 30 days)
Show older comments
Hello,
I have two data sets A and B. Each has 6 columns. First two columns indicate latitudes and longitudes of some points. I want to extract the points in B (all the row, not just the lat or long) that has different latitudes and longitudes than A. In other words I want to find the uncommon points. To explain; I need to combine two data sets without duplicated lat and long values.
Here you can see my code where I find tie points (common latitude and longitude points).
Thank you for your help.
clear all;figure;
addpath('D:\Desktop\BOUN\JOB\Slip_Rates\Slip_Data\MAP');
LAT1=39;LAT2=42;LON1=29.0;LON2=41.0;
sf = 1;
m_proj('albers equal-area','lat',[LAT1 LAT2],'long',[LON1 LON2],'rect','on');m_gshhs_h('color',[.5 .5 .5]);hold on;
m_grid('linewi',1,'linest','none','tickdir','in','fontsize',10);
[lon1, lat1,ve1,vn1,sve1,svn1] = textread('Aktug_etal_2015.gmt','%f %f %f %f %f %f'); % REFERENCE
m_quiver(lon1,lat1,sf.*ve1,sf.*vn1,1,'r','filled','AutoScale','off','linewidth',1.5);
aktug = [lon1, lat1,ve1,vn1,sve1,svn1]; % data A
[lon2, lat2,ve2,vn2,sve2,svn2] = textread('kremer_2014.txt','%f %f %f %f %f %f'); % PROJECTED
m_quiver(lon2,lat2,sf.*ve2,sf.*vn2,1,'k','filled','AutoScale','off','linewidth',1.5);
kreemer = load('kremer_2014.txt'); % data B
% finding tie points
k = 1;
for i = 1:size(lat2)
ind = find(abs(lat2(i)-lat1)<0.01 & abs(lon2(i)-lon1)<0.015 & lon1>LON1 & lon1<LON2 & lat1>LAT1 & lat1<LAT2);
for j = 1:length(ind)
tiepoints(k,:) = [lon2(i) lat2(i) ve2(i) vn2(i) ve1(ind(j)) vn1(ind(j)) sve2(i) svn2(i) sve1(ind(j)) svn1(ind(j))];
k = k + 1;
end
end
tiepoints2 = [tiepoints(:,1) tiepoints(:,2) tiepoints(:,3) tiepoints(:,4) tiepoints(:,7) tiepoints(:,8)];
cfn = median(tiepoints(:,6)-tiepoints(:,4)); cfe = median(tiepoints(:,5)-tiepoints(:,3));
m_quiver(lon2,lat2,sf.*ve2+cfe,sf.*vn2+cfn,1,'b','filled','AutoScale','off','linewidth',1.5);
print -dtiff GPS_compare.tiff
1 Comment
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!