-
-
November 5, 2021 at 4:49 pmGuilin SunAnsys Employee一般建议直接保存为Lumerical文件格式: save - Script command 或者保存为Matlab格式:matlabsave - Script command 方法是matlabsave(“filename”, var1, …, varN);##Saves the specified workspace variables to the .mat file. 例如 x=1:10; y=x^2; matlabsave(“x_squared_data”, x, y); 使用Matlab读取后,可以直接用x, y作为变量使用。 它们均可以保存数据、变量和DATASET。 如果一定要用xtx格式,有几种方法输出数据:1:用脚本Write: write(my_string); ##Write my_string to the standard output (linux only).Linux使用 write(“testfile.txt”, my_string); ##Will write the contents of the string variable my_string to testfile.txt.将数据保存到testfile.txt 。内部实际些的是字符,因此数字需要转换,见下列脚本-------define the variables to export a=linspace(0,2*pi,9);b=sin(a); -----combine both vectors into a single 2D matrix to be output to filedata_to_print= [a,b]; ----- write the data to the filewrite(“testfile.txt”,num2str(data_to_print)); 或者使用循环语句,一次给出一个a和b的数值,中间可按空格或者逗号隔开,参见--------- write the data to the filefor (i=1:length(a) ) { str= num2str(a(i))+", "+num2str(b(i)); write(“testfile.txt”,str); }
-
Viewing 0 reply threads
- The topic ‘Ansys Insight: 如何将结果数据如何保存成txt格式’ is closed to new replies.
Ansys Innovation Space
Trending discussions
Top Contributors
-
1416
-
599
-
591
-
565
-
366
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.