Writing text file
조회 수: 6 (최근 30일)
이전 댓글 표시
If i have a variable, say time=1000, and i want to write this into a txt file, how do i do that?
this is what i have tried:
fid = fopen('exp.txt', 'w');
fprintf(fid, 'time');
fclose(fid);
thanks
댓글 수: 0
채택된 답변
Walter Roberson
2012년 1월 13일
fid = fopen('exp.txt', 'w');
fprintf(fid, '%g\n', time);
fclose(fid);
댓글 수: 2
Walter Roberson
2012년 1월 16일
Works fine for me.
>> time = 1000
time =
1000
>> fid = fopen('exp.txt', 'w');
fprintf(fid, '%g\n', time);
fclose(fid);
>> !cat exp.txt
1000
추가 답변 (1개)
sunil anandatheertha
2012년 1월 17일
ahhhhhhh, i use the dlmwrite('D:\rrr.txt','delimiter','\t') instead.
Whichever works for the moment !! ;)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!