Programming |
Typing in a series of numbers separated by commas gives you what is called a comma-separated list. MATLAB returns each value individually:
Such a list, by itself, is not very useful. But when used with large and more complex data structures like MATLAB structures and cell arrays, the comma-separated list can enable you to simplify your MATLAB code.
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:
This is the same as explicitly typing
Operator Summary | Generating a List from a Structure |
© 1994-2005 The MathWorks, Inc.