How to find if a matrix has a column vector in MATLAB

24 Views Asked by At

Imagine that $D = eye(size(A)(1))$ , being $A$ an input matrix. How can I code to appear that $A$ has $D(:,j)$ and does not have $D(:,i)$.


Example : If I have a matrix like this one: $$A = \begin{matrix} 2 & 0 & 1 & 3 \\ 4 & 1 & 2 & 7 \\ 2 & 0 & 5 & 6 \\\end{matrix}$$ what can I code to appear that $A$ has $D(:,2)$ and does not have $D(:,1)$ and $D(:3)$.

1

There are 1 best solutions below

0
On BEST ANSWER

Surprisingly, but there exist the function intersect. Probably, this one will help : intersect(D',A','rows').