How to write Continue Long Statements on Multiple Lines ?
6 views (last 30 days)
Show older comments
Vuqar Samedov
on 30 Nov 2019
Commented: Walter Roberson
on 1 Dec 2019
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]';
Accepted Answer
Star Strider
on 30 Nov 2019
Try this:
formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]'];
2 Comments
Star Strider
on 30 Nov 2019
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.
More Answers (2)
Walter Roberson
on 30 Nov 2019
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 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!