cast

cast(X,target_type) returns X changed into target_type where target_type is a string specifying the desired output type.

target_type can be one of the following types:
  • 'double'
  • 'logical'
  • 'char'
  • 'cell'
  • 'string array'

Examples

> cast(1, 'logical')

	[ans: true]
> v_matrix = ['ab';'cd']

	[v_matrix:2x2 char]

> v_cells = cast(v_matrix,'cell')

	[v_cells:2x1 cell]

Resources

See also

class | num2str | cell2mat