MATLAB: Finding a vector as a subset of an array arraysubset I have a = [2 2];b = [2 3]; How to find that 'b' contains all the elements of 'a' i.e. here two 2's. Here 'b' contains only one '2'. Best Answer [u,~,j] = unique(a(:));[tf,loc] = ismember(b(:),u);s = [length(u),1];result = all(accumarray(j(:),1,s) <= accumarray(loc(tf),1,s)) Related SolutionsMATLAB: How to find order of the elements in a vector in another vector [~, idx] = ismember(A, B) MATLAB: Ismember() returning without unique indexing [tf,loc] = ismember(b,a); loc.' = 2 2 4 4 4 4 Related QuestionHow to find indices of elements but keep the order unchangedHow to find the indices of the repeating elements in an array with respect to another arrayVectors u = (2,1,0) and v = (0,1,2). calculate cos thetha where thetha is the angle between u and vRemove rows in matrix if it is repeated 2 timesHow to call vector in matrix with condition
Best Answer