Not 100% sure I have the whole answer, but here's part of it. Look at these two lines side by side:
ophi_unwrapped(i,:) = unwrap(ophi(i,:));
ophi_unwrapped(:,i) = unwrap(ophi(:,i));
The second line overwrites the results of the first line. Just blows them away. Its as if the first line had never been executed. Perhaps what you wanted was more like this:
ophi_unwrapped_rows(i,:) = unwrap(ophi(i,:));
ophi_unwrapped(:,i) = unwrap( ophi_unwrapped_rows(:,i));
That gives you an intermediate variable to store the results of the row unwrapping, which you can then subsequently process for the columns.