**3.1. Basic transformation of rough data**

As mentioned above we might obtain rough data in the form of a row vector. Let us illustrate this in this simple example. Our computational domain is 2 by 2 by 2 thus obtained row vector (x-component, apmlitude) has 8 elements. See Table 2.


**Table 2.** Amplitude of x-component of intensity of electric field [V/m]

From this we can extract axis. As long as we do not know the length of each axis we need to utilize this method to find actual axial data (see Figure 2.).

Note that actual axis arrangement can be different in your case (e.g. x and y axis arrangement may be commuted). Thus it is vital to get familiar with axial arrangement in your exporter from EM field simulator.

Furthermore, actualAxis vectors are underlined because they are growing on every loop iteration. Since axial vectors are not usually very long, this poses only mild concern. They cannot be preallocated because we generally do not know their actual length. If you are expecting very long axial vectors you may consider preallocating them safely longer than your expectations and then just using part of them which is non-zero (you may select this part of a vector using find – please refer to Matlab documentation).

Now that we know the length of each axial vector we may sort the vector of exported values and transform it to a matrix which will better represent three dimensional nature of our computational domain and will allow us to plot data with axial information. In this case we can very well utilize reshape which is built in Matlab.

MATRIX = reshape(vector\_of\_values,lenght(X),lenght(Y),lenght(Z))

Thanks to this process we now have every component of each vector (i.e. *E* and *H*) represented as three dimensional matrix and we can utilize it further.
