determining spaces between two strings in fprintf function

20 ビュー (過去 30 日間)
sermet OGUTCU
sermet OGUTCU 2021 年 7 月 12 日
回答済み: Stephen23 2021 年 7 月 12 日
fprintf('%s %s\n',' G',' G');
I need to define the lenght of the two spaces. One space starts from the first line to the first G. The second space is between the two G. For example, I need to add 10 space from the first line for the first G and 5 space between the two G. Can we define these spaces in the two variables (a=10,b=5), then add in the fprintf function?

採用された回答

Stephen23
Stephen23 2021 年 7 月 12 日
fprintf('%*s %*s\n',10,' G',5,' G');
G G

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by