Skip to content

deal

Distribute multiple inputs to multiple outputs.

[A, B, C, ...] = deal(X1, X2, X3, ...)
[A, B, C, ...] = deal(X)

Assigns each input to the corresponding output. With multiple inputs, requires the same number of outputs. With a single input X, assigns X to every output. Useful for parallel multi-assignment from a varargout-returning function.

[a, b, c] = deal(1, 2, 3) % a=1, b=2, c=3
[a, b, c] = deal(0) % a=b=c=0
  • assign — Assign a value to a variable by name.