Simple question regarding feld width in matlab
4 ビュー (過去 30 日間)
古いコメントを表示
If saw a question in the internet which asks to write a segment code that prompt the user for a charcter and will print it twice; once left-justified in a field width of 5, and again right-justified in a field width of 3:
Here is my working:
ask=input('Enter a charcter: ','s');
fprintf('First time: %c\n',ask);
fprintf('First time:%c \n',ask);
3 件のコメント
Walter Roberson
2018 年 6 月 23 日
編集済み: Walter Roberson
2018 年 6 月 23 日
Neither one are correct. Your first one does not left justify and the right one does not print the character.
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!