Generating a List from a Cell Array
Extracting multiple elements from a cell array yields a comma-separated list. Given a 4-
by-6 cell array as shown here
C = cell(4,6);
for k = 1:24
C{k} = k*2;
end
C
C =
[2] [10] [18] [26] [34] [42]
[4] [12] [20] [28] [36] [44]
[6] [14] [22] [30] [38] [46]
[8] [16] [24] [32] [40] [48]
extracting the fifth column generates the following comma-separated list:
C{:,5}
ans =
34
ans =
36
ans =
38
ans =
40
This is the same as explicitly typing
C{1,5},C{2,5},C{3,5},C{4,5}
Comma-Separated Lists