Matlab write string on new line

조회 수: 9 (최근 30일)
Haziq Razali
Haziq Razali 2018년 12월 12일
답변: Guillaume 2018년 12월 12일
How can I split a long string of text into multiple lines in Matlab ? For example,
fprintf(fileID,'%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n',..
I want to to split the
%s
so I can comment what each item means but I still want them to be in the same line in the output. But the ... do not work within strings.
fprintf(fileID,'%s,... % ID
%s,... % frame
%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n',..

채택된 답변

KSSV
KSSV 2018년 12월 12일
Use fprintf for each line seperatly suing \n at the end.

추가 답변 (1개)

Guillaume
Guillaume 2018년 12월 12일
fprintf(fileID, ['%s,' ... ID
'%s,' ... frame
'%s,' ...
'%s\n'], ...
...
);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by