MATLAB: Removing specific elements from array arrayelementismember Lets assume i have a = [1 1 3 5]; c = [1 5]; i want to remove c from a and the output should be a = [1 3] a = setdiff(a,c) %this works but it removes both the '1' . Best Answer >> a = [1,1,3,5];>> c = [1,5];>> [X,Y] = ismember(c,a);>> a(Y(X)) = []a = 1 3 Related SolutionsMATLAB: Array. find if one element or another is in the array The ismember function does exactly that:A=[1 2 3 4 5];B=[1 3];Out = ismember(A, B)Out = 1×5 logical array 1 0 1 0 0 MATLAB: What does mean this X=[A’B’C’] ? Why not try it in command window??A,B and C are turned into column vectors and are horizantally concatenated with each other.Note: always use nonconjugate transpose instead of conjugate transpose.>> A = [1 2 3]B = [-1 1 3]C = [5 6 7]A = 1 2 3B = -1 1 3C = 5 6 7>> X = [A' B' C']X = 1 -1 5 2 1 6 3 3 7>> Related QuestionHow to combine vectors of different length into matrixRemoving elements from an ArrayFind indices of one array in another array.How to remove duplicate elements from array based on another arrayGet the value of element from matrix
Best Answer