setdiffFS finds the positive integers in a which are not present in the positive integers in b
c=setdiffFS(a,b)
example
c =setdiffFS(a, b) Example of use of setdiffFS.
c =setdiffFS(a, b)
c
a
b
expand all
Define two vectors (containing positive integers) with values in common.
A = [3 6 2 1 5 1 1]; B = [2 4 6];C=setdiffFS(A,B);disp(C);
1 3 5
20000 calls to setdiff and to setdiffFS.
% Analysis of computational time.n=100;nsimul=20000;tSETDIFF=0;tSETDIFFFS=0;for j=1:nsimula=randi(n,[300,1]);b=randi(n,[40,1]);tsetdiff = tic;c=setdiff(a,b);tSETDIFF = tSETDIFF + toc(tsetdiff);tsetdiffFS = tic;cFS=setdiffFS(a,b);tSETDIFFFS = tSETDIFFFS + toc(tsetdiffFS);if ~isequal(c,cFS)error('FSDA:setdiffFS:WrongOutput','c and cFS are different')endenddisp(array2table([tSETDIFF tSETDIFFFS],'VariableNames',{'setdiff time' 'setdiffFS time'}))
A vector of length na containing positive integer numbers.
Data Types: single| double
single| double
A vector of length nb containing positive integer numbers.
Column vector.
Note that the elements of c contain no repetitions and are sorted.
Riani, M., Perrotta, D. and Cerioli, A. (2015), The Forward Search for Very Large Datasets, "Journal of Statistical Software"
setdiff