Overloading Equality Operator for Arrays
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!