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
ans =
14
12
How to Use the Comma-Separated Lists
Common uses for comma-separated lists are
• “Constructing Arrays” on page 2-83
• “Displaying Arrays” on page 2-83
2 Program Components
2-82
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
ans =
14
12
How to Use the Comma-Separated Lists
Common uses for comma-separated lists are
• “Constructing Arrays” on page 2-83
• “Displaying Arrays” on page 2-83
2 Program Components
2-82
