The module "series_cell2mat" of the Mastrave modelling library
Copyright and license notice of the function series_cell2mat
Copyright © 2006,2007,2008,2009 Daniele de Rigo
The file series_cell2mat.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/.
Function declaration
[ x_cols , y_cols ] = series_cell2mat( x_series_cell , y_series_cell , sep )
Description
Rearranges a set of data series whose monodimensional domain (independent variable) values are collected in x_series_cell and whose n -dimensional codomain ( n dependent variables) values are collected in y_series_cell . This utility may help to visualize complex data using the standard 2-D plot facilities. See the example for an intuitive introduction. The codomain set of data y_series_cell must be passed as a cell array of n_param matrices each of them representing an n -dimensional data series. All data series must have the same number of n_elem vectors of data (i.e each matrix must be composed by n_elem rows, each row being a row-vector of n columns; each column being a dimension of the codomain). The domain set of data x_series_cell can be passed as a cell array of n_param matrices each of them representing the domain values associated to the corresponding n -dimensional data series. Alternatively, x_series_cell can be passed as a cell array of n_param column vectors, so implying that each dimension of the data series shares a common codomain set of values. Cell-arrays having only one element (a matrix of n_elem rows and n columns, or a column vector of n_elem rows) can be passed too. Values will be replicated to fit the size of y_series_cell . If the domain or codomain data set is passed as matrix, it is regarded as the unique element of a cell-array. In case of multi-array elements, all dimensions beyond the second one are splitted in bidimensional slices and regarded as data matrices, each of them being an element of the cell-array.
x_series_cell and y_series_cell are rearranged to become matrices of
n_elem * n_param rows and n columns. If the optional input argument
sep is passed and its value is the string 'true', then each matrix element
of the data series will be terminated with a trailing row of nan values. In
this case the number of output matrices rows will be
n_elem * ( n_param + 1 ).
Input arguments
x_series_cell ::cellnumeric:: column vector, matrix or cell array of column vectors ── or matrices ── all having the same size. It collects the values of the mono-dimensional independent variable. y_series_cell ::cellnumeric:: matrix or cell array of matrices all having the same size. It collects the values of the n -dimensional dependent variables. sep ::string:: string to enable/disable the separation of each matrix with a row of nan values. Available categories are: sep value │ behaviour ────────────┼───────────────────────────────────────────── 'true' │ Add to each matrix element of the data │ series a trailing row of nan values ────────────┼───────────────────────────────────────────── 'false' │ Don't add any trailing row
Example of usage
version: 0.3.2
Support
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.