MATLAB: How to find location/coordinates of NaN in a sort condition

find nansort

I have a matrix like this:
3 2 3 6 2
9 4 NaN 4 2
NaN 3 2 4 3
7 2 NaN 9 3
7 1 8 2 4
So the location/coordinates NaN that will be out in a sort condition is(2,3),(3,1), and(4,3).
I've already try this code:
[I,J] = find(isnan(Data));
but the value does't well organized. is the any solution? thanks before :')

Best Answer

[ii jj] = find(isnan(Data));
outij = sortrows([ii jj],1);
OR
[jj ii] = find(isnan(Data.'))