MATLAB: Finding a row in matrix finding a rowMATLAB a=[1 2 3;5 8 9 ;5 6 4;1 2 5] I want to check whether a contains [5 6 4] in any row or not. How can I do this? Best Answer Read about ismembera=[1 2 3;5 8 9 ;5 6 4;1 2 5] ;b = [5 6 4] ;idx = find(ismember(a,b,'rows')) Related SolutionsMATLAB: Extract Common and Uncommon Matrix with Row Repetition c=ismember(A,B,'rows')C=A(c,:)D=A(~c,:)Note that 2 8 1row is both located at A and B matrices, therefore your D matrix should look like D=[3 5 7;5 5 5; 5 5 5] MATLAB: How to find which row has a specied values that I entered For example, A=[4 5 6 7; 8 4 5 6; 4 5 6 8; 8 4 8 9 ;1 2 2 4; 4 5 6 8]; % A matrixv = [4 5 6 8]; % vector you are searching for[flag,locs] = ismember(A,v,'rows'); % flag gives logical true for each row if v is equal to corresponding row of A locations = find(flag); % if you want to get exact location such as 3rd row, 5th row and if you are using with rows option, use this. Related QuestionFinding duplicatesFinding Duplicate rowsHow to find matrix in a matrixFinding nearest vlaue
Best Answer