To whom it may concern:
I have gone through many threads on MathWorks for this topic but have not found a solution.
I have a function called 'ask_for_parameters' that calls up a script containing constants called 'constants.m'. The constants contain messages corresponding to each variable and I need them to be placed in the input call of my validation function called 'ask_for_number'.
I keep getting the same error (even though there are no inputs in the functions and I have deleted all similar files and checked for correct paths):
**Error using ask_for_number Too many input arguments.
Error in ask_for_parameters (line 12) b1 = ask_for_number(STRING_B1);
MY FUNCTIONS:
function [ b1, b2, h, h1, l, v ] = ask_for_parameters()
clc;
%fprintf('Total number of inputs = %d\n',nargin)
fprintf('Insert values for each parameter. If a parameter is unknown, leave blank and press ENTER\n\n');
constants;
b1 = ask_for_number(STRING_B1);
b2 = ask_for_number(STRING_B2);
h = ask_for_number(STRING_H);
h1 = ask_for_number(STRING_H1);
l = ask_for_number(STRING_L);
v = ask_for_number(STRING_V);
end
function valid_number = ask_for_number ()
clc;
% fprintf('nb_inputs = %d\n',nargin)
valid_number = -1;
while valid_number <= 0;
txt_input = input('Enter a number\n', 's'); valid_number = str2double(txt_input); if valid_number > 0; end if isnan(valid_number) || isempty(txt_input); valid_number = []; end
end
end
CONSTANTS SCRIPT:
STRING_B1 = 'Enter value for base 1:';
STRING_B2 = 'Enter value for base 2:';
STRING_H1 = 'Enter value for partial height:';
STRING_H = 'Enter value for total height:';
STRING_L = 'Enter value for length:';
STRING_V = 'Enter value for volume:';
Any suggestions would be greatly appreciated.
Best Answer