Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
YIP
YIP le 3 Avr 2015
Commenté : dpb le 4 Avr 2015
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')

Réponses (1)

dpb
dpb le 3 Avr 2015
fid=fopen('seralno.txt','a+');
See
doc fopen
for details.
  2 commentaires
YIP
YIP le 4 Avr 2015
THANK YOU. HOW ABOUT EXCEL?
dpb
dpb le 4 Avr 2015
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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by