To get the field value of an array within a structure in MATLAB, you can use the dot notation to access the field, and then use parentheses to index into the array. Here is an example:
main.m150 chars6 lines
In this example, we define a structure myStruct with a field myArray that contains the array [1, 2, 3]. We then use dot notation to access the myArray field and parentheses to index into the array, retrieving its second element.
Note that if the field you are accessing contains a multi-dimensional array, you can use multiple sets of parentheses to index into different dimensions of the array. For example:
main.m166 chars6 lines
In this example, we define a structure myStruct with a field myArray that contains the 2D array [1, 2; 3, 4]. We use dot notation to access the myArray field, and then use two sets of parentheses to index into the second row and first column of the array, retrieving its 2 element.
gistlibby LogSnag