How do I format a .txt file I've created?

1 次查看(过去 30 天)
Im trying to display max_speed for 6 different satellites in a .txt file, however when i run this code only sat_id appears, not max_speed. Can someone help me fix this?
fileID=fopen('report.txt','w');
fprintf(fileID,'name\n');
fprintf(fileID,'studentnumber\n');
fprintf(fileID,'sat_id,max_speed(m/s),min_speed(m/s),orbital_period_before(s),orbital_period_after(s)\n');
for n = 1:6
fprintf(fileID,'%d\n', stat(n).sat_id);fprintf(fileID,'%15:9e %15:9e\n', stat(n).max_speed);
end fclose(fileID);
end

采纳的回答

Stephen23
Stephen23 2018-3-18
编辑:Stephen23 2018-3-18
%15:9e
is not a valid format string. Perhaps you meant to write a decimal point:
%15.9e

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by