subsref2 uses sparse matrix multiplication to compute C=A(i,j). It uses the following method. Let I and J be identity matrices of the right size so that I*A*J is equal to A. Then C = I(i,:)*A*J(:,j) is the same as C=A(i,j).
Tim Davis (2020). subsref2 (https://www.mathworks.com/matlabcentral/fileexchange/22720-subsref2), MATLAB Central File Exchange. Retrieved .
Converted to a toolbox, modified comments.