Question: 2) Write a function with no input argument and two output arguments. This function will keep prompting the user to input a string, then
2) Write a function with no input argument and two output arguments. This function will keep prompting the user to input a string, then stores them in a cell array, until the user hits the return key without inputting a string (i.e. the input() function returns empty). This function will then return the resulting cell array as the first output argument, the number of strings as the second output argument. function [n, arr] = user_input n = 1; string=input('Enter the string:', 's'); while (string == "") == false arr{n} = string; n = n+1; string=input('Enter string:', 's'); end n = n-1; end 2) Write a function with no input argument and two output arguments. This function will keep prompting the user to input a string, then stores them in a cell array, until the user hits the return key without inputting a string (i.e. the input() function returns empty). This function will then return the resulting cell array as the first output argument, the number of strings as the second output argument. function [n, arr] = user_input n = 1; string=input('Enter the string:', 's'); while (string == "") == false arr{n} = string; n = n+1; string = input('Enter string:', 's'); end n = n-1; end
Step by Step Solution
3.38 Rating (151 Votes )
There are 3 Steps involved in it
It looks like there are a couple of syntax errors and logical issues in your c... View full answer
Get step-by-step solutions from verified subject matter experts
