Pseudo Element by Element Vector Subtraction
Show older comments
I am trying to subtract vectors stored in two different arrays. I want to subtract every row vector in matrix B from every row vector in matrix A such that the results of row vector 1 of A minus each of the row vectors of B is stored in a an array, the results of row vector 2 of A minus all row vectors B is stored in a different array...and so on until the end. Matrix A is a 63x2 array while matrix B is a 61x2 array. My final goal is to comapre all the results and identify and store all vectors that have duplicates.
A = [0 0
-5.22988566179964 6.05378360734033
5.82743694158990 -5.48096512411759
-7.71867012579003 13.6568061570767
-6.41307857048505 -4.78251223195356
-12.8832160382871 3.72429135615449
13.0437173772689 -8.93426740941455
-3.95560029264112 20.7165020025679
-14.9311651399118 17.1180076350708
-12.8261571409701 -9.56502446390712
-20.5365464147745 1.39479910496865
20.2599978129478 -12.3875696947115
-1.17023252546704 28.2159504090567
-22.1436601540336 20.5792091130649
-17.3827161983918 -16.1405677537219
-28.1898767912619 -0.934693146217198
23.2616199344730 -19.8031117948934
4.31055626391175 34.0435531963286
27.4257074918059 -8.83051968124259
-29.3561551681553 24.0404105910590
-19.3637625207825 -23.8914035453345
-35.8432071677493 -3.26418539740304
23.0577732626258 -27.8005142815998
9.79134505329053 39.8711559836006
10.4567903913941 28.9226347191244
34.5914171706640 -5.27346966777369
-31.5385456076644 31.7369794350011
-21.3448088431732 -31.6422393369470
-43.4965375442368 -5.59367764858889
25.6191596676504 -35.3793862084867
16.3972779876710 44.3835444937432
-35.1703582141579 38.8650883841765
-23.3258551655640 -39.3930751285596
-51.1498679207242 -7.92316989977473
28.1805460726749 -42.9582581353737
23.0032109220515 48.8959330038858
37.7741257337733 2.06617379783899
-29.3310994911081 -31.1740922588744
17.7048992093770 -36.5474963910512
-38.8021708206513 45.9931973333520
-22.3878218988045 -47.3378906450113
35.8328768192608 -45.2910320517349
29.7346992697278 53.2187867632789
18.1810613102127 55.2792607505272
40.9568342968826 9.40581726345168
-42.4339834271448 53.1213062825274
-22.9362553876826 -55.3190698002663
43.4852075658468 -47.6238059680961
36.8803922974807 49.6216947220428
-46.6615356421781 1.75362029283338
-32.2411590073453 50.5706555784546
-30.3866778744434 -47.4731795247682
32.3995579608740 -52.5168414608354
13.3589116983739 61.6625884971687
48.2086638919891 6.02780490060624
-49.3011842938828 49.0174602503434
-17.7011930022771 -61.3683773491444
46.9026731045917 -40.3904852029502
44.0260853252335 46.0246026808068
-49.8265337401194 9.10091823425565
-38.3629147966204 -48.0893325587636
55.4604934870957 2.64979253776079
51.1717783529864 42.4275106395707];
B = [5.82743694158990 -5.48096512411759
-2.48878446399039 7.60302254973639
-6.41307857048505 -4.78251223195356
-7.65333037648742 -2.32949225118584
7.21628043567895 -3.45330228529695
3.76306983314891 7.05969584549112
-7.21249501412177 3.46120147799410
-6.41307857048505 -4.78251223195356
-7.65333037648742 -2.32949225118584
7.21628043567895 -3.45330228529695
2.78536776717408 7.49944840648882
-7.21249501412177 3.46120147799410
-4.55655905742170 -6.57554328981479
-7.65333037648742 -2.32949225118584
3.00162212152522 -7.41554210018192
5.48078878937879 5.82760278727195
7.16570967885811 3.55705001346891
-7.21249501412177 3.46120147799410
-1.98104632239072 -7.75083579161255
-7.65333037648742 -2.32949225118584
-0.203846671847199 -7.99740248670635
5.48078878937879 5.82760278727195
6.14623412748235 -5.12091847720419
7.16570967885811 3.55705001346891
-2.18239043950905 7.69656884394205
-1.98104632239072 -7.75083579161255
-7.65333037648742 -2.32949225118584
2.56138640502452 -7.57887192688698
6.60593293438051 4.51238851014260
-3.63181260649347 7.12810894917545
-1.98104632239072 -7.75083579161255
-7.65333037648742 -2.32949225118584
2.56138640502452 -7.57887192688698
6.60593293438051 4.51238851014260
3.18270856310927 7.33964346561268
-7.98629064793488 0.468147078072581
-7.91426045827336 -1.16811018256442
-3.63181260649347 7.12810894917545
0.938033266759421 -7.94481551645176
7.65233074658597 -2.33277391636118
6.73148834767623 4.32285375939311
-4.82214961183880 6.38332774664147
3.18270856310927 7.33964346561268
-3.63181260649347 7.12810894917545
-0.548433488878012 -7.98117915525501
7.65233074658597 -2.33277391636118
7.14569302775288 -3.59709204123606
-3.16499809794131 7.34729794142227
6.56101181330606 4.57745824510266
-7.99885597563890 -0.135288879756905
-3.43331885838680 -7.22580940910052
-4.82214961183880 6.38332774664147
7.25182959510656 -3.37801236284544
-6.86720086673803 -4.10384603218402
5.23506238540546 -6.04930754887804
3.41746553874489 7.23332076514592
7.14569302775288 -3.59709204123606
-3.16499809794131 7.34729794142227
-7.97623692217691 -0.616153033995415
7.25182959510656 -3.37801236284544
7.14569302775288 -3.59709204123606];
SizeA = size(A,1);
SizeB = size(B,1);
for i = 1:SizeA
for j = 1:SizeB
vectortest(i,:) = vein_node_array(i,:)-Btest(j,:);
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!