populationindicies.m

来自「matlab7 gads工具箱」· M 代码 · 共 14 行

M
14
字号
function indicies = populationIndicies(population)
%POPULATIONINDICIES Find the indicies of each sub-population
%   indicies = populationIndicies(population); returns a 2 by n array
%   containing the locations of each subpopulation in the population aray.

%   Copyright 2004 The MathWorks, Inc. 
%   $Revision: 1.4 $  $Date: 2004/01/16 16:50:03 $

lengths = cumsum(population);
lengths = lengths(1:(end-1));
starts = [1, 1 + lengths];
ends = starts + population - 1;

indicies = [starts;ends];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?