How to enter the data into a excel and notepad that always start from a new line?
1 次查看(过去 30 天)
显示 更早的评论
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')
0 个评论
回答(1 个)
dpb
2015-4-3
fid=fopen('seralno.txt','a+');
See
doc fopen
for details.
2 个评论
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 Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!