MATLAB: Simultaneously inverting many matrices

MATLABmatrix inversion

Dear all, I have many 2-by-2 matrices (which are covariance matrices). I want to invert them all. I'm curious if there's an efficient way of doing this. I thought, maybe, you create a cell, in which each element is one of these matrices, and then use cellfun() in some way to do it. Quintessentially, my question is, is there a way of simultaneously inverting many matrices? I'd appreciate any and all comments. Thank you very much in advance!
Best, John

Best Answer

2 x 2 you might as well use the formula
D = A(1, 2, :) .* A(2, 1, :) - A(1, 1, :) .* A(2, 2, :);
V11 = -A(2, 2, :) ./ D;
V12 = A(1, 2, :) ./ D;
V21 = A(2, 1, :) ./ D;
V22 = -A(1, 1, :) ./ D;
invs = [V11, V12; V21, V22];