This is because nan~=nan is always true.
So one approach is to replace nan with some other value.
A(isnan(A)) = inf;
B = unique(A,'rows');
B(isinf(B)) = nan
If you have infs in your array as well as nans, pick some other value.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!