cns_layerno

Finds layer numbers in a model structure by layer name.

Syntax

Finding a Single Layer Number

z = cns_layerno(m, name)
z = cns_layerno(m, name, err)
m
A model structure.

name
A layer name. Can also be a layer number, in which case it will just be validated.

err
Affects what happens if the layer name cannot be found in m. If true, will halt with an error. If false, will cause z to return 0. Defaults to true.

z
The layer number if found. If not found, and err is false, will return 0.

Finding All Layer Numbers

s = cns_layerno(m)
m
A model structure.

s
Returns a structure with one field per layer name, where the value of each such field is the layer number.