23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2deal<br />

Purpose Deal inputs to outputs<br />

Syntax [Y1,Y2,Y3,...] = deal(X)<br />

[Y1,Y2,Y3,...] = deal(X1,X2,X3,...)<br />

Description [Y1,Y2,Y3,...] = deal(X) copies the single input to all the requested<br />

outputs. It is the same as Y1 = X, Y2 = X, Y3 = X, ...<br />

[Y1,Y2,Y3,...] = deal(X1,X2,X3,...) is the same as Y1 = X1; Y2 = X2;<br />

Y3 = X3; ...<br />

Remarks deal is most useful when used with cell arrays and structures via comma<br />

separated list expansion. Here are some useful constructions:<br />

[S.field] = deal(X) sets all the fields with the name field in the structure<br />

array S to the value X. If S doesn't exist, use [S(1:m).field] = deal(X).<br />

[X{:}] = deal(A.field) copies the values of the field with name field to<br />

the cell array X. If X doesn't exist, use [X{1:m}] = deal(A.field).<br />

[Y1,Y2,Y3,...] = deal(X{:}) copies the contents of the cell array X to the<br />

separate variables Y1,Y2,Y3,...<br />

[Y1,Y2,Y3,...] = deal(S.field) copies the contents of the fields with the<br />

name field to separate variables Y1,Y2,Y3,...<br />

Examples Use deal to copy the contents of a 4-element cell array into four separate<br />

output variables.<br />

C = {rand(3) ones(3,1) eye(3) zeros(3,1)};<br />

[a,b,c,d] = deal(C{:})<br />

a =<br />

b =<br />

0.9501 0.4860 0.4565<br />

0.2311 0.8913 0.0185<br />

0.6068 0.7621 0.8214<br />

deal<br />

2-405

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!