Borrar filtros
Borrar filtros

How to save data in a file without deleting old data

3 visualizaciones (últimos 30 días)
Mo H
Mo H el 29 de Mzo. de 2020
Respondida: Ameer Hamza el 29 de Mzo. de 2020
Hello,
I need to write a function that takes multiple inputs and then save the result in another file (let's call it savefile.M). However, I want to use the same function for another set of data and save the result in savefile.M without deleting the results obtained previously.
Thank you

Respuestas (1)

Ameer Hamza
Ameer Hamza el 29 de Mzo. de 2020
If it is a text file than you can open it is append mode
f = fopen('test.txt', 'a');
fprintf(f, 'This is first line.\n');
fclose(f);
f = fopen('test.txt', 'a');
fprintf(f, 'This is second line.\n');
fclose(f);
It will write new data under the current data.

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by