New user question on fprintf
显示 更早的评论
Hey, i'm a new user to Matlab and am working on some homework. I'm trying to figure out how to write a script that will prompt the user to input a character and then perform the following actions.
A. use fprintf to print the character without specifying a field width
B. use fprintf to print the character specifying a field width of 5
My code I've been working on is below, you can see my mistakes.
% Prompt user to enter character
disp ('Please enter a character...any character')
%STRvar = input('Please enter a character', 's')
%fprintf (' var1 is %3.1s/')
%character = input(' Enter a character: ', 's');
fprintf ('The character %d has no specified field width\n')
If anyone could help me it'd be appreciated, thanks!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!