Effacer les filtres
Effacer les filtres

write values of different programm in next row of a text file

1 vue (au cours des 30 derniers jours)
Bruce Rogers
Bruce Rogers le 1 Juil 2021
Commenté : Bruce Rogers le 1 Juil 2021
Hello everyone,
I got a large programm for different experiments. Now I want to write the new result value in the same text file in the next row. Is this possible and how can I do that? Is there a function for that? I'm using Matlab R2020b for acadeic use.
I'm thankful for your ideas!

Réponse acceptée

Smitesh Patil
Smitesh Patil le 1 Juil 2021
Modifié(e) : Smitesh Patil le 1 Juil 2021
Open the file in append mode
fileID = fopen('experiment_data.txt','a');
Then write the data using fprintf (assuming that data is just array of integers)
fprintf(fileID, "%d ", data);
then close the file
fclose(fileID);

Plus de réponses (1)

KSSV
KSSV le 1 Juil 2021
Tou need to use '\n' in fprintf to write in the next line of the file. Read about fprintf.
fprintf('new line\n')
fprintf('Hello I am here')

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by