Historically, graphics objects were represented to the user as double, and it was valid to do things like
and contrawise it was valid to do things like
and you can still do
L2 = double(plot(rand(1,3)))
Thus, the particular error comes about in old code that happened to assign a graphics object to a variable thinking that graphics objects are represented by doubles (which they used to be), and then assigns a double (not intended to be a graphics object) into the same array.
You can work around this kind of problem by carefully using double() and handle(), but it is usually best to separate out the graphics objects from the non-objects.