Main Content

getsamples

(To be removed) Get neural network data samples

getsamples will be removed in a future release. For more information, see Transition Legacy Neural Network Code to dlnetwork Workflows.

For advice on updating your code, see Version History.

Syntax

getsamples(x,ind)

Description

getsamples(x,ind) returns the samples of neural network data x indicated by the indices ind. The neural network data may be in matrix or cell array form.

If x is a matrix, the result is the ind columns of x.

If x is a cell array, the result is a cell array the same size as x, whose elements are the ind columns of the matrices in x.

Examples

This code gets samples 1 and 3 from matrix data:

x = [1 2 3; 4 7 4]
y = getsamples(x,[1 3])

This code gets elements 1 and 3 from cell array data:

x = {[1:3; 4:6] [7:9; 10:12]; [13:15] [16:18]}
y = getsamples(x,[1 3])

Version History

Introduced in R2010b

collapse all