changed ensureCorrectDimensions by using n-dimensional versions of meshgrid and interp3 so variable ordering and dimension ordering would stay consistent.