4 if isscalar(firstVec) || isscalar(secVec)
5 unitedVec = [firstVec(:);secVec(:)];
6 nFirstElems = numel(firstVec);
7 isThereVec = unitedVec(1:nFirstElems)==unitedVec(1+nFirstElems:end);
10 indThereVec = double(isThereVec);
12 indThereVec = find(isThereVec);
13 indThereVec = indThereVec(1);
14 isThereVec = any(isThereVec);
17 isThereVec =
false(size(firstVec));
18 indThereVec = zeros(size(firstVec));
28 [unionSortedVec,indUnionSortedVec] = sort([unqFirstVec;unqSecVec]);
30 isSortedUnionNeighborEqVec = unionSortedVec(1:end-1)==...
31 unionSortedVec(2:end);
32 indSortedUnionNeighborEqVec = indUnionSortedVec(...
33 isSortedUnionNeighborEqVec);
36 isThereVec =
ismember(indFirstLeft2RightVec,...
37 indSortedUnionNeighborEqVec);
39 nFirstUnqElems = size(unqFirstVec,1);
40 isSortedUnionNeighborEqVec = find(isSortedUnionNeighborEqVec);
41 [isThereVec,indThereVec] =
ismember(indFirstLeft2RightVec,...
42 indSortedUnionNeighborEqVec);
43 isFirstAmonthEqSortedUnionNeighborsVec =...
44 isSortedUnionNeighborEqVec(indThereVec(isThereVec));
45 indWhereFirstAmongEqNeighborsVec =...
46 indSecRight2LeftVec(indUnionSortedVec(...
47 isFirstAmonthEqSortedUnionNeighborsVec+1)-nFirstUnqElems);
48 indThereVec(isThereVec) = indWhereFirstAmongEqNeighborsVec;
51 isThereVec = reshape(isThereVec,size(firstVec));
53 indThereVec = reshape(indThereVec,size(firstVec));
function uniquesortableobj(in inpVec)
UNIQUE implementation strictly for sortable entities i.e. for those that have 1) full order defined b...
function ismembersortableobj(in firstVec, in secVec)
ISMEMBER implementation strictly for sortable entities i.e. for those that have 1) full order defined...
function ismember(in leftVec, in rightVec, in varargin)
ISMEMBER - ismember implementation for arrays of any type.