If A and B are the save size then instead of the "find" function (which produces linear or subscript indices) use logic indexing for speed e.g.:
L=A==2; A(L)=; B(L)=;
Reshape is not required (and is slow for large arrays). The approach above and that of Mr. Roberson only work if the empty entries of  lead to the removal of say always n colums or n rows. In other cases you'll get an error. You could use sparse arrays and set the entries to zero instead or use NaN.
Good luck, Kevin