Data Structure: A Cell Array List Container

Provides a useful 1D container for storing an ordered heterogeneous set of elements
1.6K Downloads
Updated 1 Sep 2016

View License

Intent: Provides a useful 1D data structure (or container) for storing an ordered heterogeneous set of elements.
Motivation: MATLAB® R2009a provides the "containers.Map" data structure for storing an unordered heterogeneous set of elements - the Map ADT is a container that is indexed with a "key" of any data type. A List ADT is a data container that is indexed by integers. The benefit in using a List ADT opposed to a native MATLAB cell array is the List ADT hides the complexity in implementation of the operations you would perform to insert and remove elements in/from arbitrary positions, for example.

Implementation: Class 'CellArrayList' is a concrete realisation of the the List ADT which uses a "native" MATLAB cell array as its storage mechanism.

The source files are contained in the zip file 'CellArrayList.zip'. Refer to the comments in 'List.m' and 'CellArrayList.m' for full details on the motivation and implementation. The script 'testCellArrayList.m' demonstrates the use of 'CellArrayList.m'. Further, a corresponding UML class diagram is illustrated in 'CellArrayList_UML_Diagram.pdf'.

Written by Bobby Nedelkovski
MathWorks Australia
Copyright 2009-2010, The MathWorks, Inc.

Cite As

Bobby Nedelkovski (2024). Data Structure: A Cell Array List Container (https://www.mathworks.com/matlabcentral/fileexchange/25024-data-structure-a-cell-array-list-container), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Dictionaries in Help Center and MATLAB Answers
Acknowledgements

Inspired: Design Pattern: Iterator (Behavioural)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.5.0.1

Updated license

1.5.0.0

Bug fix to allow creation of N-D arrays of CellArrayLists - see my comment under 'Comments and Ratings' on '11 Apr 2010'. All methods including overloaded system functions 'isempty', 'length' and 'display' have been updated in class CellArrayList.

1.4.0.0

Bug fix (much thanks to João Henriques) to avoid infinite while-loop in add() method when capacity reaches 0. Added constant property INITIAL_CAPACITY due to bug fix. UML Diagram has been updated to reflect the change.

1.3.0.0

Property 'numElts' changed to concrete protected in abstract class List - conforms with R2009b OOP. Updated UML diagram to reflect this change. Bug fix with remove() method in CellArrayList.

1.2.0.0

Minor fix in comments of 'testCellArrayList.m'. Removed abstract declaration 'list' from abstract class 'List' as this presumes a List ADT is implemented using a flat array-like data structure. UML Diagram has been updated to reflect the change.

1.1.0.0

Minor fix in comments of 'testCellArrayList.m'. Removed abstract declaration 'list' from abstract class 'List' as this presumes a List ADT is implemented using a flat array-like data structure. UML Diagram has been updated to reflect the change.

1.0.0.0