Recently, I have started exploring MATLAB from a beginner’s level, and I came to know that this software has got some fantastic features to build any type of code. Still, there are specific rules that must be followed first, for matrix operations. Many times, we work on building an efficient code, but it does not run. After spending quite a time debugging, we come to know that the error occurred is so fundamental in a level like either about case sensitivity or we forget to put a dot in middle structure, comma, or semicolon at the end.

One of the basic error in MATLAB is “** Dot indexing is not supported for variables of this type**”. Dot indexing is a part of matrix operation, substructure, field indexing, and graphical user interface (GUI) structure. The basic example of dot indexing in matrix operation is given below, For example:

```
a = ones(1,5);
parameter.A = [parameter.a; a];
```

In the above example, we want to add the multiple number of rows in an already defined matrix, after doing the operation in the above example, we are facing the error above. The first row, in which *a = ones(1,5)*, are five ones generated in a single row; this means you can interchange all of these in multiple rows, or you can take the compliment to get all rows. Now, we wish to add a number of rows on our desire, instead of taking the complement of a matrix, which converts the matrix on the opposite form. We are extending the above example, which has only one row, into two or more rows,

```
Parameter.A = [];
A = ones(1,5);
Parameter.A = [parameter.A; a];
B = 2*ones(1,5);
Parameter.A = [parameter.A; b];
```

the output of the above script is attached below,

```
>> parameter =
Struct with fields:
A: [2 x 5 double]
>> parameter.A
Ans =
1 1 1 1 1
2 2 2 2 2
```

This example thoroughly explained that how can we add no of rows in a matrix, during its operation, and now we have to discuss another example of dot indexing in terms of structures, fields, etc.

Index substructures and field, in this example, we will discuss the indexing of substructures and fields using dot notation. We must reference the field values individually, for code generation in MATLAB. For example, the bus structure model, described in bus signals to MATLAB function blocks, dot notation is used in MATLAB, for indexing the fields and substructures, the code for substructure indexing by dot notation is given below,

```
function [outbus, outbus1] = fcn(inbus)
substruct.a1 = inbus.ele3.a1;
substruct.a2 = int8([1 2;3 4]);
mystruct = struct('ele1',20.5,'ele2',single(100),
'ele3',substruct);
outbus = mystruct;
outbus.ele3.a2 = 2*(substruct.a2);
outbus1 = inbus.ele3;
```

The above code is the best example, chosen from the MATLAB directory, which helps us in terms of substructure and field indexing. First of all, the two matrices *a1* and* a2* are defined, and then indexed with structure by dot indexing for *inbus,* an integer value is int8. The first matrix is used for the input bus dot indexed structure and the second matrix for the output bus dot indexed structure.

The dot notation used in the above substructure example is explained in the table below, the *substruct.a1* is used for field *a1* of local structure, *inbus.ele3.a1* value of field *a1* of field *ele3* as a substructure of input, and the third one is containing the value in row 1, the field in column 1 of *a2*.

Dot Notation | Symbol Resolution |

substruct.a1 | Field a1 of local structure substruct |

inbus.ele3.a1 | Value of field a1 of field ele3, a substructure of structure input inbus |

inbus.ele3.a2(1,1) | Value in row 1, column 1 of field a2 of field ele3, a substructure of structure input inbus |