DEAL Multiple Simultaneous Assignments

Section: Elementary Functions

Usage

When making a function call, it is possible to assign multiple outputs in a single call, (see, e.g., max for an example). The deal call allows you to do the same thing with a simple assignment. The syntax for its use is
   [a,b,c,...] = deal(expr)

where expr is an expression with multiple values. The simplest example is where expr is the dereference of a cell array, e.g. expr <-- A{:}. In this case, the deal call is equivalent to

   a = A{1}; b = A{2}; C = A{3}; 

Other expressions which are multivalued are structure arrays with multiple entries (non-scalar), where field dereferencing has been applied.