필터 지우기
필터 지우기

To remove part of the string while writing in a text file

조회 수: 4 (최근 30일)
Vishwas
Vishwas 2022년 12월 2일
댓글: Vishwas 2022년 12월 2일
Hi, I am using the following sample code to write the string in a text file, however apart from the string, I am getting additional "..." in my output file. Could you please advice me on how to get rid of the "..." ? The code is as follows:
formatSpec = '\t%d km/h, %g g\t%s';
A1 = 80;
A2 = 0.2;
A3 = 'Long_Pre_Event.res';
str = sprintf(formatSpec,A1,A2,A3);
writematrix(str,strrep(A3,'.res','.logVDT'),'FileType','text')

채택된 답변

Askic V
Askic V 2022년 12월 2일
편집: Askic V 2022년 12월 2일
formatSpec = '\t%d km/h, %g g\t%s';
A1 = 80;
A2 = 0.2;
A3 = 'Long_Pre_Event.res';
fileID = fopen('exp.txt','w');
fprintf(fileID,formatSpec,A1,A2,A3);
fclose(fileID);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by