The module "frequency2index" of the Mastrave modelling library
Copyright © 2007,2008,2009,2010,2011,2014 Daniele de Rigo
The file frequency2index.m is part of Mastrave.
Mastrave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Mastrave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Mastrave. If not, see http://www.gnu.org/licenses/.
idx = frequency2index( frequency_vals )
Module supporting the expansion of an array of frequencies frequency_vals into an array where the position of each element in frequency_vals is repeated according to the frequency.
frequency_vals ::numel:: Array counting the positive occurrences (presences). For each element of the array, the local cumulated amount of presences is provided. An element's value of zero is interpreted as an absence of positive observations.
n_elems = [2 0 3 4 0 0 5 3 ] pos = frequency2index( n_elems )' % Dealing with first elements with frequency zero n_elems = [0 0 2 0 3 4 0 0 5 3 ] pos = frequency2index( n_elems )' % Dealing with last elements with frequency zero n_elems = [2 0 3 4 0 0 5 3 0 0] pos = frequency2index( n_elems )'
See also: mat2groups, frequency_resampling Keywords: data-transformation, frequency, position Version: 0.2.1
The Mastrave modelling library is committed to provide reusable and general - but also robust and scalable - modules for research modellers dealing with computational science. You can help the Mastrave project by providing feedbacks on unexpected behaviours of this module. Despite all efforts, all of us - either developers or users - (should) know that errors are unavoidable. However, the free software paradigm successfully highlights that scientific knowledge freedom also implies an impressive opportunity for collectively evolve the tools and ideas upon which our daily work is based. Reporting a problem that you found using Mastrave may help the developer team to find a possible bug. Please, be aware that Mastrave is entirely based on voluntary efforts: in order for your help to be as effective as possible, please read carefully the section on reporting problems. Thank you for your collaboration.