| Contents | Index |
Convert a MATLAB value into its canonical type
t=coder.typeof(v)
t=coder.typeof(v, sz, variable_dims)
t=coder.typeof(t)
t=coder.typeof(v) creates a coder.Type object denoting the smallest non-constant type that contains v. v must be a MATLAB numeric, logical, char, enumeration, fixed-point array or a struct constructed from any of the preceding types. Use coder.typeof only to specify input parameter types. For example, use it with the fiaccel function -args option. Do not use it in MATLAB code from which you intend to generate a MEX function.
t=coder.typeof(v, sz, variable_dims) returns a modified copy of t=coder.typeof(v) with (upper bound) size specified by sz and variable dimensions variable_dims. If sz specifies inf for a dimension, then the size of the dimension is unbounded and the dimension is variable size. When sz is [], the (upper bound) sizes of v remain unchanged. If the variable_dims input parameter is not specified, all the dimensions of the type are fixed except for those that are unbounded. When variable_dims is a scalar, it is applied to all the dimensions, except if the dimension is 1 or 0, which are fixed, or if the dimension is unbounded, which is always variable size.
t=coder.typeof(t), where t is a coder.Type object, returns t itself.
t |
coder.Type object |
Create a type for a simple fixed-sized 5x6 matrix of doubles
coder.typeof(ones(5, 6)) % returns 5x6 double coder.typeof(0, [5 6]) % also returns 5x6 double
Create a type for a variable-sized matrix of doubles
coder.typeof(ones(3,3), [], 1) % returns :3 x :3 double % ':' indicates variable-size dimensions
Create a type for a structure with a variable-size field
x.a = coder.typeof(0,[3 5],1); x.b = magic(3); coder.typeof(x) % Returns % coder.StructType % 1x1 struct % a: :3x:5 double % b: 3x3 double % ':' indicates variable-size dimensions
Create a type for a matrix with fixed-size and variable-size dimensions.
coder.typeof(0, [2,3,4], [1 0 1]); % Returns :2x3x:4 double % ':' indicates variable-size dimensions
coder.typeof(10, [1 5], 1) % returns double 1 x :5 % ':' indicates variable-size dimensions
Create a type for a matrix of doubles, first dimension unbounded, second dimension with fixed size
coder.typeof(10,[inf,3]) % returns double:inf x 3 % ':' indicates variable-size dimensions
Create a type for a matrix of doubles, first dimension unbounded, second dimension with variable size with an upper bound of 3
coder.typeof(10, [inf,3],[0 1]) % returns double :inf x :3 % ':' indicates variable-size dimensions
Convert a fixed-sized matrix to a variable-sized matrix
coder.typeof(ones(5,5), [], 1) % returns double :5x:5 % ':' indicates variable-size dimensions
coder.newtype | coder.resize | fiaccel

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |