Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab oop - how to check if two objects are equal

Tags:

oop

matlab

I’m wondering if there is an easy way to check if two Matlab objects are equal. I got

A = Section(1, Point(0, 0), Point(0, 0));
B = Section(1, Point(0, 0), Point(0, 0));
    if(A == B)              % I know this is incorrect, but how could I fix it up?
       fprintf('Equal\n');
    else
       fprintf('Not Equal\n');
    end

After instantiating two sections, I want to check if they are the same (in the case above they are equal). How could I do that?

like image 570
user3535716 Avatar asked Aug 24 '14 04:08

user3535716


1 Answers

isequal is probably what you want, but this page has further information on comparing and sorting handle objects. eq (==) tests if two objects have the same handle, i.e., handle equality, whereas isequal tests if two objects have equal property values.

like image 173
horchler Avatar answered Oct 02 '22 15:10

horchler