# DFB Laser: How extract the data to txt. file

Hi,

Example:

Base on above example, how to extract the data to txt file. Data that I mention is from graf (power vs current ) once run the script. (lsf). Refer to below figure.

Let me know, what script command that needs to use for extract the data. Show me an example script base on an example.

-Kalai-

Hi @kalaivani.tarumaraja
An Engineer from Lumerical @mbenes have uploaded a post , how to extract data to .txt from multiple simulations. You can use this instructions for one simulation. Please, read the following link How to extract results from multiple simulation files and save them into txt file

1 Like

Hi Konslekk,

thanks for the feedback. But, I;m still confuse about it.
Example:

Actually, the graf will appear once run the script potLI.lsf (file). Kindly refer below figure;

How to extract the data from the graf, power vs. current?? Not mistaken me, the script will not be too long. If my wrong, pls correct me.

Is it as below command (I try but couldn’t run the script)
data_write=[myr.getparameter(myr.getparameter)[A], myr.getattribute(myr.getattribute)[W]];
filename=“PC.txt”;

Please guide. It’s important for me.

-Kalai-

Try the following commands:

myMtrx = [x,y];
filename = "PC.txt";
write(filename, num2str(myMtrx));


Note that you may need to change the dimension of x and y to make the first line of conducting the matrix work. The transpose command can be used here to change the dimension of the vectors.

Hi Gwang,

No. I still can’t run the script. Due of myMtrx. Pls check below command. Could be transpose wrong. I not sure how to use transpose. But, I implement it in the script & can’t run the script.

myr=getsweepresult(“sweep”,“power”);
x=myr.getparameter(myr.getparameter);
y=myr.getattribute(myr.getattribute);
plot(x,y,“current [A]”,“Power[W]”);
holdoff;
myMtrx=[myr.getparameter(myr.getparameter),myr.getattribute(myr.getattribute),transpose(myr.getparameter,myr.getattribute)];
filename = “PC.txt”;
write(filename, num2str(myMtrx));

-Kalai-

If you are running the dfbLaser.icp file in the following page:

https://kb.lumerical.com/en/index.html?laser_dfb-laser.html

please try the following script, it should work.

myr=getsweepresult("sweep","power");
x=myr.getparameter(myr.getparameter);
y=myr.getattribute(myr.getattribute);

myMtrx = [transpose(x),y];
filename = "PC.txt";
write(filename, num2str(myMtrx));