MATLAB: How could I check that how many elements of x is inside y MATLAB Suppose I have x = [2,7,8,11]; and y = [1,2,4,5,7,8,9,12,15,21,27] How could I check that how many elements of x is inside y? Best Answer You can use ismember:>> x = [2,7,8,11];>> y = [1,2,4,5,7,8,9,12,15,21,27];>> ismember(x,y)ans = 1 1 1 0>> sum(ismember(x,y))ans = 3 Related SolutionsMATLAB: Help plotting basic x vs y x =linspace(0,L,100);y =w0./(120*E*I*L)*(-5*x.^4+6*L^2*x.^2-L^4);plot(x,y); MATLAB: Error using glmfit: Second column in Y B2 = glmfit(x(c,:), y==2, 'binomial');That is, your use of 1 and 2 is confusing it, so you need to convert those to 0 and 1. Related QuestionHow to back interpolation to find x from z and yHow to solve this matrix for yHow to find value of symfun x at time yHow to evaluate a polynomial p at each point in y
Best Answer