Matlab write string on new line

1 次查看(过去 30 天)
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 中查找有关 Entering Commands 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by