Expert Answer:
s:
When you make the call:
obj.roll_dice;
It is actually equivalent to:
roll_dice(obj);
So obj
is the "secret" automatic argument being passed to roll_dice
. If you rewrite the method roll_dice
to accept a single input argument (even if you don't use it), things should work correctly.
Alternatively, if you know for sure that your method roll_dice
is not going to perform any operations on the class object, you can declare it to be a static method as Dan suggests.
For more information on object-oriented programming in MATLAB, here's a link to the online documentation.