Overloading Equality Operator for Arrays
Mostrar comentarios más antiguos
I have a class with the eq() operator overloaded, but I'm not sure the best way to make it work with object arrays, in a similar way to the way standard arrays work for equality. Here's the code that I have right now. For reference, the class is designed to work with spheres in 3D space, with a center [x, y, z] and a radius.
function test=eq(a,b)
if all(size(a.xyz)==size(b.xyz))
if (a.radius==b.radius)
test=all(a.xyz==b.xyz);
else
test=false;
end
else
test=false;
end
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!