I want to check invertibility for a model that has the same number of observables as shocks. If x represents the states of the system once the saddle path has been evaluated, eps represents the shocks and y represents the observables, then the reduced form can be summarised as

x(t)=A*x(t-1)+B*eps(t), y(t)=E*x(t)

(although there are other ways of representing y(t)).

I know how to obtain A and B:

A = [ ];
B = [ ];
state = M_.state_var';
control = [1:1:size(oo_.dr.ghu,1)]';
for j = 1:size(state,1)
control( control == state(j) ) = [];
end
A = [oo_.dr.ghx( oo_.dr.inv_order_var( state ), : ) ];
B = [oo_.dr.ghu( oo_.dr.inv_order_var( state ), : ) ];

I note that you in your software you also convert to a minimal realization. No need to do that though:
Using my (A,B,E) notation, if (A,B) is not controllable, then there exists an eigenvalue-eigenvector pair (e,x) such that x'A=ex' and x'B=0. It is then trivial to show that x'A(I-B(EB)^(-1)B)=ex', so an uncontrollable mode of A is also an uncontrollable mode of the matrix A(I-B(EB)^(-1)B) that one is testing, so it cannot be a source of non-invertibility if the matrix A has only stable eigenvalues. An analogous result holds for non-observable modes with the e-e pair (f,y) where Ay=fy and Ey=0.