%% Preserve Legacy Behavior of setdiff
% Use the 'legacy' flag to preserve the behavior of setdiff from R2012b and prior releases in your code.
% Find the difference of A and B with the current behavior.

A = [3 6 2 1 5 1 1]; 
B = [2 4 6];
[C1,ia1] = setdiff(A,B)

%
% Find the difference of A and B, and preserve the legacy behavior.

[C2,ia2] = setdiff(A,B,'legacy')

% Copyright 2012 The MathWorks, Inc.