New user question on fprintf
Show older comments
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!
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!