I'm trying to write a function N = Deletevar(x,M) that returns a matrix N by deleting every row of the matrix M that contains the variable x.
My code is :
function N = Delete_var(x,M)
However when i call Delete_var(3,[1,2,3;3,4,5;7,8,9]), I get:
Index in position 1 exceeds array bounds (must not exceed 2).
Error in Delete_var (line 9)
if M(i,j)== x
Why is that? How to solve the problem? Please help!