MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
ans =

3 78

Use deal to overwrite each element in the list.

[c{:}] = deal([10 20],[14 12]);
c{:}

ans =

10 20

ans =

14 12

This example does the same as the one above, but with a comma-separated list of vectors
in a structure field:

s(1).field1 = [31 07];
s(2).field1 = [03 78];
s.field1

ans =

31 7

ans =

3 78

Use deal to overwrite the structure fields.

[s.field1] = deal([10 20],[14 12]);
s.field1

ans =

10 20

2 Program Components

Free download pdf