Amrita Pati
Ansys Employee

Hi Mateus,

You are welcome!

Generally, if you have a mode expansion monitor called "Exp" and the expansion results are "out" then you use the following code:

out = getresult("Exp","expansion for out");

But if you are using loop, it could be a bit tricky since the expansion results are a dataset. I believe the simplest approach would be to save the individual results of the output (expansion results) in different arrays. And if you wish, you can combine these results to form a dataset after the loop ends.

For example, if I am only interested in T_forward and T_backward results for 2 iterations and the data is collected at a single wavelength then I can use the following code:


T_forward = matrix(2);

T_backward = matrix(2);

for(i = 1:1:2){


out = getresult("Exp","expansion for out");

T_forward(i) = out.T_forward;

T_backward(i) = out.T_backward;



Here, I just have 2 reptitions and a single wavelength, which is why I initialize T_forward and T_backward as matrix(2).

I believe you can also use the sweep utility instead of the loop. The sweep utility automatically reconstructs dataset so you can easily access all the results at one place. Please let me know if you have any further questions.