TAGGED: fdtd
-
-
October 30, 2024 at 7:13 pmjohannes.haatajaSubscriber
I believe the readdata script command is not working properly, or more precily, cannot read decimals and scientific notation.
For instance using the example testfile.txt:
Time Value
0.0 3.2e-6
1.0 2.8e10
2.0 4.1e5
3.0 3.3Âprovided on the documentation page of readdata results in:
M=readdata("testfile.txt");
?M;
result:Â
0 Â 3 Â
1 Â 2 Â
2 Â 4 Â
3 Â 3I'm hoping someone could verify the issue (and I hope Ansys will fix the command ASAP).
-
October 31, 2024 at 12:06 amKirillAnsys Employee
Hello johannes.haataja,
I've just checked the script in Lumerical 2024 R2.3. Here is my result:
M = readdata("testfile.txt"); ?M;
Result:
0 Â Â 3.2e-06
1 Â Â 2.8e+10
2 Â Â 410000
3 Â Â 3.3As a debugging step, try to write data to the file and then read it back form it.
Best regards,
Kirill
-
October 31, 2024 at 7:05 amjohannes.haatajaSubscriber
Â
Much obliged Kirill for your help,Â
 I don’t know why I get different behavious. I’ve replicated the issue on Lumerical 2024 R2.2 and R2.3 on two different Ubuntu systems.Manipulating elements of M inside Lumerical to haveÂ
Â
0 Â 3.2e-06 Â
1 Â 2.8e+10 Â
2 Â 410000 Â
3 Â 3.3ÂÂ
then using write function
Â
write('writetest.txt',num2str(M),'overwrite');
M2 = readdata('writetest.txt');
?M2;
result:Â
0 Â 3 Â
1 Â 2 Â
2 Â 410000 Â
3 Â 3
Perhaps as temporary solution, I'll multiply the values of my data file by some large enough prefactor and then divide M by the same prefactor to get the desired outcome. -
November 1, 2024 at 6:34 pmKirillAnsys Employee
Hello johannes.haataja,
1. Check if the data is being saved correctly. What output do you get in writetest.txt when you open it manually in a text editor? Also consider formatting the data while saving it to the file; see format and num2str functions.
2. I’m not sure if this is relevant in your case, but you can use MATLAB (.mat) files to save and load data. Check out the matlabsave / matlabload functions.
3. The Lumerical Data File (LDF) format might be another option; consider the loaddata / savedata functions.
4. Double-check the System Requirements and Ubuntu Linux installation guide.
Best regards,
Kirill
-
- You must be logged in to reply to this topic.
-
1051
-
447
-
374
-
225
-
201
© 2024 Copyright ANSYS, Inc. All rights reserved.