2

In MATLAB one can use cell arrays and structures to "hold" data of different types. For example, one can define a cell array in which the first cell contains an array, the second a differently sized array, the third a string, etc. Similar things can be done with the structure data type.

Do these or similar exist in Mathematica?

Ed Davis
  • 41
  • 1

1 Answers1

2

Mathematica doesn't need such a thing. "Everything is an expression." In many cases, subexpressions may be of a variety of types. Consider List. Any element of a list may be of any "type" you wish. List is basically a passive "wrapper", but even active things can wrap combinations of types. Consider:

1+"a string"

which simply fails to evaluate. Plus doesn't have a rule that applies to such a construct, so it becomes a passive wrapper here.

John Doty
  • 13,712
  • 1
  • 22
  • 42