MATLAB Object-Oriented Programming

(Joyce) #1
for k = 1:5
objArray(k) = ObjProp;
end

Access the RegProp property of the second element of the object array using array
indexing:

objArray(2).RegProp

ans =

91

Assign the values of all RegProp properties to a numeric array:

propValues = [objArray.RegProp]

propValues =

82 91 13 92 64

Use standard indexing operations to access the values of the numeric array. For more
information on numeric arrays, see “Matrices and Arrays”.

See Also


Related Examples



  • “Initialize Object Arrays” on page 10-5

  • “Initialize Arrays of Handle Objects” on page 10-11

  • “Class Constructor Methods” on page 9-21


10 Object Arrays

Free download pdf