If you look at the example given at http://www.mathworks.com/help/matlab/matlab_oop/enumerations.html , you will see that the value of Enumeration1.Left
is not the value 1
, but instead an object. You can confirm this by examining the object returned:
a = Enumeration1.Left;
whos a
display(a)
This shows you that a
is an object of class Enumeration1
, with size 108 bytes
and value Left
. Converting Left
into 1
is done with
b = uint32(a);
So the following should work:
directions(uint32(Enumeration1.Left)) = 7;
Interestingly - when I use Matlab 2012a, I can actually use the syntax you have above, and Matlab doesn't complain.