MATLAB
logicals) and returns the variable numChanges (1 x 1 double). Write code using a for loop that will assign to the variable numChanges the number of times that successive elements of V change from 0 to 1 or from 1 to 0. For example, if V = [0, 0, 1, 1], then numChanges would equal 1, and if V = [0, 1, 0, 1], then numChanges would equal 3.