How to enter the data into a excel and notepad that always start from a new line?

조회 수: 1 (최근 30일)
YIP
YIP 2015년 4월 3일
댓글: dpb 2015년 4월 4일
For example, the first time I run the program and write a data in the excel or notepad file. Then I want to write the data in the same file with starting from a new line without overwrite the first result.
Here is the codes.
fid = fopen('serialno.txt', 'w'); % This portion of code writes the serial no.
fprintf(fid,'%s\n',serialno); % to the text file, if executed a notepad file with the
fclose(fid); % name serialno.txt will be open with the number plate written.
winopen('serialno.txt')

답변 (1개)

dpb
dpb 2015년 4월 3일
fid=fopen('seralno.txt','a+');
See
doc fopen
for details.
  댓글 수: 2
dpb
dpb 2015년 4월 4일
If the above solved your problem, please "Accept" the answer...
As for Excel, that's a horse of a Microsoft color...either use COM or xlswrite with a location(*); they're not sequential text files.
(*) I presume there's some method to find the first empty location if don't keep it externally, but that's an Excel question not Matlab and "I don't do Windows... :) " Look that up in the Help for COM or ask on an Excel newsgroup.

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

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by