필터 지우기
필터 지우기

How to open new text file and how to write on the text file using matlab code?

조회 수: 58 (최근 30일)
How to open new text file and how to write on the text file using matlab code?
PS: How to go to next line(like we use Enter to go to next line) on the text file using code....can anyone help

채택된 답변

Image Analyst
Image Analyst 2015년 7월 25일
Try something like this
fid = fopen(filename, 'wt');
if fid ~= -1
fprintf('This is line 1. Backslash n makes a new line.\n');
fprintf('My result is %f\n, result);
fprintf('My string = %s\n', myString);
fclose(fid);
else
warningMessage = sprintf('Cannot open file %s', filename);
uiwait(warndlg(warningMessage));
end
  댓글 수: 7
Image Analyst
Image Analyst 2015년 7월 26일
But if you want extra safety and security of saving the old version in the recycle bin instead of blowing it away forever, do this:
recycle on;
delete(filename);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Low-Level File I/O에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by