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 63×2 array while matrix B is a 61×2 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.053783607340335.82743694158990 -5.48096512411759-7.71867012579003 13.6568061570767-6.41307857048505 -4.78251223195356-12.8832160382871 3.7242913561544913.0437173772689 -8.93426740941455-3.95560029264112 20.7165020025679-14.9311651399118 17.1180076350708-12.8261571409701 -9.56502446390712-20.5365464147745 1.3947991049686520.2599978129478 -12.3875696947115-1.17023252546704 28.2159504090567-22.1436601540336 20.5792091130649-17.3827161983918 -16.1405677537219-28.1898767912619 -0.93469314621719823.2616199344730 -19.80311179489344.31055626391175 34.043553196328627.4257074918059 -8.83051968124259-29.3561551681553 24.0404105910590-19.3637625207825 -23.8914035453345-35.8432071677493 -3.2641853974030423.0577732626258 -27.80051428159989.79134505329053 39.871155983600610.4567903913941 28.922634719124434.5914171706640 -5.27346966777369-31.5385456076644 31.7369794350011-21.3448088431732 -31.6422393369470-43.4965375442368 -5.5936776485888925.6191596676504 -35.379386208486716.3972779876710 44.3835444937432-35.1703582141579 38.8650883841765-23.3258551655640 -39.3930751285596-51.1498679207242 -7.9231698997747328.1805460726749 -42.958258135373723.0032109220515 48.895933003885837.7741257337733 2.06617379783899-29.3310994911081 -31.174092258874417.7048992093770 -36.5474963910512-38.8021708206513 45.9931973333520-22.3878218988045 -47.337890645011335.8328768192608 -45.291032051734929.7346992697278 53.218786763278918.1810613102127 55.279260750527240.9568342968826 9.40581726345168-42.4339834271448 53.1213062825274-22.9362553876826 -55.319069800266343.4852075658468 -47.623805968096136.8803922974807 49.6216947220428-46.6615356421781 1.75362029283338-32.2411590073453 50.5706555784546-30.3866778744434 -47.473179524768232.3995579608740 -52.516841460835413.3589116983739 61.662588497168748.2086638919891 6.02780490060624-49.3011842938828 49.0174602503434-17.7011930022771 -61.368377349144446.9026731045917 -40.390485202950244.0260853252335 46.0246026808068-49.8265337401194 9.10091823425565-38.3629147966204 -48.089332558763655.4604934870957 2.6497925377607951.1717783529864 42.4275106395707];B = [5.82743694158990 -5.48096512411759-2.48878446399039 7.60302254973639-6.41307857048505 -4.78251223195356-7.65333037648742 -2.329492251185847.21628043567895 -3.453302285296953.76306983314891 7.05969584549112-7.21249501412177 3.46120147799410-6.41307857048505 -4.78251223195356-7.65333037648742 -2.329492251185847.21628043567895 -3.453302285296952.78536776717408 7.49944840648882-7.21249501412177 3.46120147799410-4.55655905742170 -6.57554328981479-7.65333037648742 -2.329492251185843.00162212152522 -7.415542100181925.48078878937879 5.827602787271957.16570967885811 3.55705001346891-7.21249501412177 3.46120147799410-1.98104632239072 -7.75083579161255-7.65333037648742 -2.32949225118584-0.203846671847199 -7.997402486706355.48078878937879 5.827602787271956.14623412748235 -5.120918477204197.16570967885811 3.55705001346891-2.18239043950905 7.69656884394205-1.98104632239072 -7.75083579161255-7.65333037648742 -2.329492251185842.56138640502452 -7.578871926886986.60593293438051 4.51238851014260-3.63181260649347 7.12810894917545-1.98104632239072 -7.75083579161255-7.65333037648742 -2.329492251185842.56138640502452 -7.578871926886986.60593293438051 4.512388510142603.18270856310927 7.33964346561268-7.98629064793488 0.468147078072581-7.91426045827336 -1.16811018256442-3.63181260649347 7.128108949175450.938033266759421 -7.944815516451767.65233074658597 -2.332773916361186.73148834767623 4.32285375939311-4.82214961183880 6.383327746641473.18270856310927 7.33964346561268-3.63181260649347 7.12810894917545-0.548433488878012 -7.981179155255017.65233074658597 -2.332773916361187.14569302775288 -3.59709204123606-3.16499809794131 7.347297941422276.56101181330606 4.57745824510266-7.99885597563890 -0.135288879756905-3.43331885838680 -7.22580940910052-4.82214961183880 6.383327746641477.25182959510656 -3.37801236284544-6.86720086673803 -4.103846032184025.23506238540546 -6.049307548878043.41746553874489 7.233320765145927.14569302775288 -3.59709204123606-3.16499809794131 7.34729794142227-7.97623692217691 -0.6161530339954157.25182959510656 -3.378012362845447.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,:); endend
Best Answer