Main Content

tonndata

Convert data to standard neural network cell array form

Syntax

[y,wasMatrix] = tonndata(x,columnSamples,cellTime)

Description

[y,wasMatrix] = tonndata(x,columnSamples,cellTime) takes these arguments,

x

Matrix or cell array of matrices

columnSamples

True if original samples are oriented as columns, false if rows

cellTime

True if original samples are columns of a cell array, false if they are stored in a matrix

and returns

y

Original data transformed into standard neural network cell array form

wasMatrix

True if original data was a matrix (as opposed to cell array)

If columnSamples is false, then matrix x or matrices in cell array x will be transposed, so row samples will now be stored as column vectors.

If cellTime is false, then matrix samples will be separated into columns of a cell array so time originally represented as vectors in a matrix will now be represented as columns of a cell array.

The returned value wasMatrix can be used by fromnndata to reverse the transformation.

Examples

Here data consisting of six timesteps of 5-element vectors, originally represented as a matrix with six columns, is converted to standard neural network representation and back.

x = rands(5,6)
columnSamples = true; % samples are by columns.
cellTime = false;     % time-steps in matrix, not cell array.
[y,wasMatrix] = tonndata(x,columnSamples,cellTime)
x2 = fromnndata(y,wasMatrix,columnSamples,cellTime)

Version History

Introduced in R2010b