struct

Creates a struct.

Syntax

  • st = struct()

  • st = struct([])

  • st = struct(object)

  • st = struct(field, value)

  • st = struct(field, value, field2, value2, ..., fieldn, valuen)

Input argument

  • field, field2, ... , fieldn - strings : field names, valid names are same than variable identifiers.

  • value, value2, ..., valuen - all data types supported by Nelson.

  • object - an object created with 'class' builtin.

Output argument

  • st - a struct

Description

struct returns a structure.

Examples

struct()
struct([])
date_st = struct('day', 15, 'month' ,'August','year', 1974)

Other way to create a struct:

date_st.day = 15
date_st.month = 'August'
date_st.year = 1974)

See also

cell, istruct.

History

VersionDescription

1.0.0

initial version

1.3.0

Scalar String allowed as field name.

Author

Allan CORNET

Last updated