필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Bruce Rogers
Bruce Rogers 2021년 7월 1일
댓글: Bruce Rogers 2021년 7월 1일
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!

채택된 답변

Smitesh Patil
Smitesh Patil 2021년 7월 1일
편집: Smitesh Patil 2021년 7월 1일
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);

추가 답변 (1개)

KSSV
KSSV 2021년 7월 1일
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')

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by