필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Christopher Maraj
Christopher Maraj 2018년 3월 18일
편집: Stephen23 2018년 3월 18일
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