Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of slrange2indcells
Home > sltoolbox > utils > slrange2indcells.m

slrange2indcells

PURPOSE ^

SLRANGE2INDCELLS Converts a range array to indices cell array

SYNOPSIS ^

function C = slrange2indcells(range)

DESCRIPTION ^

SLRANGE2INDCELLS Converts a range array to indices cell array

 $ Syntax $
   - C = slrange2indcells(range)

 $ Arguments $
   - range:        the 2 x d array specifying the range
   - C:            the 1 x d indices array

 $ Description $
   - C = slrange2indcells(range) converts an range array to a cell array
     of indices. 
     For example, for a range array in the form:
     [s1, s2, ..., sd; e1, e2, ..., ed], it will outputs the cell array as
     C = {s1:e1, s2:e2, ..., sd:ed}.
     So that A(C{:}) will give A(s1:e1, s2:e2, ..., sd:ed).

 $ History $
   - Created by Dahua Lin, on Jul 29th, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:

SOURCE CODE ^

0001 function C = slrange2indcells(range)
0002 %SLRANGE2INDCELLS Converts a range array to indices cell array
0003 %
0004 % $ Syntax $
0005 %   - C = slrange2indcells(range)
0006 %
0007 % $ Arguments $
0008 %   - range:        the 2 x d array specifying the range
0009 %   - C:            the 1 x d indices array
0010 %
0011 % $ Description $
0012 %   - C = slrange2indcells(range) converts an range array to a cell array
0013 %     of indices.
0014 %     For example, for a range array in the form:
0015 %     [s1, s2, ..., sd; e1, e2, ..., ed], it will outputs the cell array as
0016 %     C = {s1:e1, s2:e2, ..., sd:ed}.
0017 %     So that A(C{:}) will give A(s1:e1, s2:e2, ..., sd:ed).
0018 %
0019 % $ History $
0020 %   - Created by Dahua Lin, on Jul 29th, 2006
0021 %
0022 
0023 d = size(range, 2);
0024 C = cell(1, d);
0025 
0026 for i = 1 : d
0027     C{i} = range(1, i) : range(2, i);
0028 end
0029

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com