matlab结果输出到文本的方法

matlab程序输出到文本,目前熟悉的有两种方法

1、输出类型为科学计数法:格式为 save    fliename.txt    variable   -ASCII     

save EDNS1.txt EDNS -ASCII
save LOLP1.txt LOLP -ASCII
save Wind_bus_cut1.txt Wind_bus_cut -ASCII
save Load_bus_cut1.txt Load_bus_cut -ASCII
save Lamda_Voltage_mean1.txt Lamda_Voltage_mean -ASCII
save Lamda_Lines_mean1.txt Lamda_Lines_mean -ASCII
2、这种输出文本的方式有点像C++输出文本的方式,可以自己定义输出的格式

ends = fopen('EDNS.txt','wt');
fprintf(ends,'%10.4g,\n',EDNS);
fclose(ends);

ends1 = fopen('LOLP.txt','wt');
fprintf(ends1,'%10.4g,\n',LOLP);
fclose(ends1);

ends2 = fopen('Wind_bus_cut.txt','wt');
fprintf(ends2,'%10.4g,\n',Wind_bus_cut);
fclose(ends2);

ends3 = fopen('Load_bus_cut.txt','wt');
fprintf(ends3,'%10.4g,\n',Load_bus_cut);
fclose(ends3);

ends4 = fopen('Lamda_Voltage_mean.txt','wt');
fprintf(ends4,'%10.4g,\n',Lamda_Voltage_mean);
fclose(ends4);

ends5 = fopen('Lamda_Lines_mean.txt','wt');
fprintf(ends5,'%10.4g,\n',Lamda_Lines_mean);
fclose(ends5);



你可能感兴趣的:(C++/matlab)