-
-
August 27, 2022 at 2:37 pm
megan.obrien
SubscriberHi,
I have calculated and saved to a text file the data for both neffTM and neffTE for varying fill factor of a grating coupler. I want to load this data into another Lumerical script and use it for calculating the different pitch values required.
The lines of code I have used to load the textfile into the script is as follows:
M = readdata("textfile.txt");
And the data is then loaded as a [17,3] matrix called M into the script workspace. I need to access the 2nd and 3rd columns for the pitch calculations, as te 2nd column is the neffTM values and the 3rd column is the neffTE values.
However, I am failing to access them as it is. Can anyone help me out please?
Â
-
August 29, 2022 at 5:12 pm
Guilin Sun
Ansys EmployeeHere is an intro about matrix  https://optics.ansys.com/hc/en-us/articles/360034929613-matrix-Script-command
Since this is a 2D matrix, you can access it as
neffTM=M(n,2);
neffTE=M(n,3)
where n is the index for fill factor., eg, n=1
you have the first value of the fill factor M(1,1); and neffTM and neffTE are the correspodent neff for this fill factor.
Please try and compare your original data.
-
- The topic ‘How to extract data from matrix for calculations in Lumerical Script’ is closed to new replies.
-
3647
-
1313
-
1142
-
1075
-
1013
© 2025 Copyright ANSYS, Inc. All rights reserved.