Method Reference: string.size

string: sz = size (str)
string: dim_sz = size (str, dim)
string: dim_sz = size (str, d1, d2, …)
string: [rows, columns, …, dim_n_sz] = size (…)

Return the size of a string array.

sz = size (str) returns a row vector with the size (number of elements) of each dimension for the string array str.

dim_sz = size (str, dim) returns the size of the corresponding dimension specified in dim. If dim is a vector, then dim_sz is a vector of the same length and with each element corresponding to a specified dimension. Multiple dimensions may also be specified as separate arguments.

With a single output argument, size returns a row vector. With several, the size of dimension N is returned in the Nth argument. Asking for fewer output arguments than the array has dimensions folds the trailing dimensions into the last one, so [r, c] = size (str) on a 2-by-2-by-2 array returns 2 and 4; asking for more pads with ones. When a dimension is named, however, the number of output arguments must equal the number of dimensions requested.

Source Code: string