In this paper, we develop the matrix-analytic method to discuss an interesting but challenging bilateral stochastic matching problem: A matched queue with matching batch pair (m,n) and two types of impatient customers, where the two types of customers arrive according to two independent Poisson processes. Once m A-customers and n B-customers are matched as a group, the m+n customers immediately leave the system. We show that this matched queue can be expressed as a novel bidirectional level-dependent quasi-birth-and-death (QBD) process whose analysis has its own interests, and specifically, computing the maximal non-positive inverse matrices of bidirectional infinite sizes by using the RG-factorizations. Based on this, we can provide an effective matrix-analytic method to deal with this matched queue, including the system stability, the average stationary queue lengths, the average sojourn times, and the departure process. We believe that the methodology and results developed in this paper can be applicable to studying more general matched queueing systems, which are widely encountered in many practical areas.