ABSTRACT

In both R and MATLAB, a matrix or vector can only hold a set of values of the same type, for example floating-point values, integers, logical values, characters, etc. Sometimes it is convenient to build a more general object which can contain values of different types. As with vectors, the elements of lists can be referred to by number, but if names are provided, then they may also be used to access elements of the list. In both platforms, there are two very different methods for extracting the contents of one or more elements of a list or cell array. To access elements of a vector list “bare,” one can refer to the elements by name or number. One can use double square brackets with names and numbers, or a dollar sign with names only. To access the elements of a cell array “bare,” one use curly braces for matrix indexing.