How to write Continue Long Statements on Multiple Lines ?
조회 수: 5 (최근 30일)
이전 댓글 표시
formatSpec = '%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%f%f%q%q%q%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%f%q%q%f%q%q%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%C%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%f%q%q%q%q%q%q%q%q%q%q%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%[^\n\r]';
채택된 답변
Star Strider
2019년 11월 30일
Try this:
formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]'];
댓글 수: 2
Star Strider
2019년 11월 30일
First, use my code, or that of others who have responded to your series of related Questions. They are easier and less prone to error.
Second, it is not possible to break up that long character array into several lines of arbitrary length. Every continued line has to be the same length.
추가 답변 (2개)
Walter Roberson
2019년 11월 30일
formatSpec = ['%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q' ...
'%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q' ...
'%q%q%q%q%q%q%q%f%f%q%q%q%f%q%q%q%q%q%q%q' ...
'%q%q%q%q%q%q%q%q%q%q%q%q%f%q%q%f%q%q%f%q' ...
'%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q' ...
'%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q' ...
'%q%q%q%C%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q' ...
'%q%q%q%q%f%q%q%q%q%q%q%q%q%q%q%f%q%q%q%q' ...
'%q%q%q%q%q%q%q%q%q%q%[^\n\r]' ];
or
formatSpec = "%f%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q" + ...
"%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q" + ...
"%q%q%q%q%q%q%q%f%f%q%q%q%f%q%q%q%q%q%q%q" + ...
"%q%q%q%q%q%q%q%q%q%q%q%q%f%q%q%f%q%q%f%q" + ...
"%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q" + ...
"%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q" + ...
"%q%q%q%C%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q%q" + ...
"%q%q%q%q%f%q%q%q%q%q%q%q%q%q%q%f%q%q%q%q" + ...
"%q%q%q%q%q%q%q%q%q%q%[^\n\r]" ;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!