How to write Continue Long Statements on Multiple Lines ?
23 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vuqar Samedov
il 30 Nov 2019
Commentato: Walter Roberson
il 1 Dic 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]';
Risposta accettata
Star Strider
il 30 Nov 2019
Try this:
formatSpec = ['%f',repmat('%q',1,160), '%[^\n\r]'];
2 Commenti
Star Strider
il 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.
Più risposte (2)
Walter Roberson
il 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 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!