Collection objects


Collection objects serve as merely a wrapper for a cell-array of LTPDA User Objects. The point of this is to provide a way to put together user objects of different classes in to a collection which can be saved/loaded/submitted/retrieved, etc.

You can create a collection object like:

      >> c = collection
      ---- collection 1 ----
      name: none
      num objs: 0
      description: 
      UUID: a339a156-956b-4657-96ef-9ea4feef8101
      ----------------------
      
  
You can then add objects to the collection by doing:
      >> c.addObjects(ao(1))
      M: running ao/ao
      M:   constructing from values
      M: running collection/addObjects
      M: running ao/char
      ---- collection 1 ----
      name: none
      num objs: 1
      01: ao | None/cdata(Ndata=[1x1])
      description: 
      UUID: c1f0200f-ad98-4fd6-beae-2dcdabb33515
      ----------------------
      
  
or
      >> c.addObjects(pzmodel(1, 10, 100), mfir())
      M: running collection/addObjects
      M: running ao/char
      ---- collection 1 ----
      name: none
      num objs: 3
      01: ao | None/cdata(Ndata=[1x1])
      02: pzmodel | pzmodel(None)
      03: mfir | none(fs=, ntaps=0.00, a=[])
      description: 
      UUID: e7f02380-5650-4788-b819-f7fa7ee50a7d
      ----------------------
      
  

You can then extract objects from the collection using getObjectAtIndex or get an array of all objects of a particular class using getObjectsOfClass. Objects can be removed from the collection using removeObjectAtIndex.

Since a collection object is an LTPDA User Object, it has history tracking capabilities. That means that everytime you add or remove an object to/from the collection, a history step is added. For example, the history of our collection above looks like: Collection history



©LTP Team