How to reuse the same format
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tianyi Yu
am 23 Nov. 2019
Bearbeitet: Tianyi Yu
am 26 Nov. 2019
For example, this code has nine "%7.0f" and one "%5.0f". Is there any way I can simplify this code, like "repmat('%7.0f' , 9)" , but still have the "defaults->" in the front?
fprintf('defaults-> %5.0f%7.0f%7.0f%7.0f%7.0f%7.0f%7.0f%7.0f%7.0f%7.0f\n' , header')
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Stijn Haenen
am 23 Nov. 2019
Maybe this will work:
a='%7.0f';
fprintf(strcat('defaults->',repmat(a,1,9),'\n'),header);
0 Kommentare
Siehe auch
Kategorien
Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!