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.


Creating collections

You can create a collection object like:

      >> c = collection
      ---- collection 1 ----
       name: 
   num objs: 0
description: 
       UUID: 158008c6-5759-415f-b5ae-35a0da984e9f
----------------------
      
  
You can then add objects to the collection by doing:
      >> c.addObjects(ao(1))
---- collection 1 ----
       name: 
   num objs: 1
         [01] obj1: ao | /cdata Ndata=[1x1], yunits=
description: 
       UUID: fc0fb4af-594c-4729-95e7-8bc95eff894f
----------------------      
  
or
      >> c.addObjects(pzmodel(1, 10, 100), mfir())
---- collection 1 ----
       name: 
   num objs: 3
         [01] obj1: ao | /cdata Ndata=[1x1], yunits=
         [02] obj1_1: pzmodel | pzmodel(g:0.1 p:-62.8319 z:-628.3185)
         [03] obj2: mfir | (fs=, ntaps=0.00, a=[])
description: 
       UUID: b47b05f5-7b64-4908-9a96-f5ac25276937
----------------------
  


Naming collections

The elements of a collection can be named, for instance when building it:

names = {'a', 'b', 'c'};
objs  = {a, b, c};
c2 = collection(plist('objs', objs, 'names', names))

Or, in an equivalent fashion:

c3 = collection(a, 'a', b, 'b');
c4 = collection(a, b, plist('names', {'a', 'b'}));


Extracting collections

You can then extract objects from the collection by:

Objects can be removed from the collection using removeObjectAtIndex.


Tracking history

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