The use of structs in MATLAB

Source: Internet
Author: User

Structs are used to build arrays of structs in MATLAB. There are usually two ways to use it:
s = struct (' Field1 ', {}, ' Field2 ', {},...)
This is the establishment of an empty structure, Field1,field2 is the domain name
s = struct (' field1 ', values1, ' Field2 ', Values2,...)
This is the assignment when the struct is built, and Values1,values2 is the value assigned to FIELD1,FIELD2.
For example: s = struct (' type ', {' big ', ' little '}, ' color ', {' Red '}, ' X ', {3 4})
This structure has three fields ' type ', ' Color ', ' x ', according to the English meaning can be seen respectively is the type, color and value meaning. The type can take the value of ' big ', ' little ', that is, the type has two kinds, respectively is big and small. The color is only red, and the value X can be 3 or 4.

The use of structs in MATLAB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.