You can create a function that takes in two vectors and checks if they have equal entries in each row, like so:
main.m94 chars4 lines
The isequal
function compares the two vectors element-wise and returns a logical value indicating if the vectors have the same size and elements or not. The equal_rows
variable will be true
if the two vectors are equal, and false
otherwise.
You can test this function with some example vectors, like this:
main.m206 chars13 lines
This function will work for vectors of any size (as long as they have the same number of elements), and can be used in other MATLAB code as needed.
gistlibby LogSnag