if vd==1 || vd==2
As the error says "||" is the short-circuiting version of "|" and can only be used on single-valued expressions.
In you code find can return a vector of length>1 if there's more than one value in the test that is true. Whether this is what you want or not you'll have to decide based on what you're actually trying to do. As written it finds all locations where the max value exists. If you want only one , then use the optional argument to specify that. See
Failing that, the short answer to make the error go away is to replace w/ |. Of course, then you'll get the problem that the 'if' will never be true because in Matlab if is true iff all elements in the array are T.
So, while it's not totally clear what you're doing from what is shown, in all likelihood you want
if vd==1 | vd==2
but that's supposing a fair amount. If you do need to do something w/ all locations that match the max() value then you'll have to write code to process the full length of the returned vd vector.
If that's not enough to figure out what your real solution is to accomplish the object, amplify the information on what you're trying to do.