# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# 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 apposed 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) ```

## See Also

#### Introduced in R2010b

Was this topic helpful?

Download ebook