cns_call

Calls the appropriate MATLAB method for an existing layer or group. This is safer than calling the method directly; see notes.

Syntax

[out1, out2, ...] = cns_call(m,  z, method, arg1, arg2, ...)
[out1, out2, ...] = cns_call(m, -g, method, arg1, arg2, ...)
m
A model structure. This will be passed as the method's first argument.

z
A layer number. The method will be called with arguments (m, z, arg1, arg2, ...).

g
A group number. The method will be called with arguments (m, g, arg1, arg2, ...). Note the "-" sign to distinguish g from a layer number. It is removed before calling the method itself.

method
The method name.

arg1, arg2, ...
Any additional inputs. Depends on the particular method.

out1, out2, ...
Any outputs. Depends on the particular method.

Notes

Using cns_call is preferable to calling the method directly, like this:
package_type.method(m,  z, arg1, arg2, ...)
package_type.method(m, -g, arg1, arg2, ...)
because if the layer (or group) is a subtype of type which overrides method, cns_call will correctly call the subtype's implementation of the method.