MathWorks.MATLAB.Types.MATLABStruct
Description
The MathWorks.MATLAB.Types.MATLABStruct
type represents the MATLAB® struct type. The object behaves like a read-only dictionary.
Class Details
Namespace: | MathWorks.MATLAB.Types |
Superclass: | System.Collections.Generic.IReadOnlyDictionary |
Creation
MATLABStruct(params(string,object)[] args)
creates an instance of
MATLABStruct
from a list of keys and values. The args
should be in the form key, value. The string must be a valid MATLAB identifier.
Methods
Public Methods
bool IsField(String field) | Determine if the struct contains this field. |
dynamic GetField(String field) | The value associated with the field. |
dynamic x = s.[propertyName]; | The value associated with property name |
override bool Equals(object o) | Compare the specified object with the |
override int GetHashCode() | The hash code value for this |
int Count | The number of key-value pairs in the struct. |
System.Collections.Generic.IEnumerable<String>
GetFieldNames | The fields in the struct. |
Examples
Exceptions
FieldNotFoundException | Field is not defined in the struct. |
UnsupportedTypeException | Passing an object that is not an anonymous type when expecting the anonymous type. |
ArgumentException | Field name is not a valid MATLAB identifier. |
Version History
Introduced in R2023a